Constructs the DGL server-specific env vars string that are required for DGL code to behave in the correct server role. Convenience function. Args: ip_config: IP config file containing IP addresses of cluster hosts. Relative path to workspace. num_proc_per_ma
(
ip_config: str,
num_proc_per_machine: int,
pythonpath: Optional[str] = "",
)
| 303 | |
| 304 | |
| 305 | def construct_dgl_server_env_vars( |
| 306 | ip_config: str, |
| 307 | num_proc_per_machine: int, |
| 308 | pythonpath: Optional[str] = "", |
| 309 | ) -> str: |
| 310 | """Constructs the DGL server-specific env vars string that are required for DGL code to behave in the correct |
| 311 | server role. |
| 312 | Convenience function. |
| 313 | |
| 314 | Args: |
| 315 | ip_config: IP config file containing IP addresses of cluster hosts. |
| 316 | Relative path to workspace. |
| 317 | num_proc_per_machine: |
| 318 | pythonpath: Optional. If given, this will pass this as PYTHONPATH. |
| 319 | |
| 320 | Returns: |
| 321 | server_env_vars: The server-specific env-vars in a string format, friendly for CLI execution. |
| 322 | |
| 323 | """ |
| 324 | server_env_vars_template = ( |
| 325 | "DGL_IP_CONFIG={DGL_IP_CONFIG} " |
| 326 | "DGL_NUM_SERVER={DGL_NUM_SERVER} " |
| 327 | "{suffix_optional_envvars}" |
| 328 | ) |
| 329 | suffix_optional_envvars = "" |
| 330 | if pythonpath: |
| 331 | suffix_optional_envvars += f"PYTHONPATH={pythonpath} " |
| 332 | return server_env_vars_template.format( |
| 333 | DGL_IP_CONFIG=ip_config, |
| 334 | DGL_NUM_SERVER=num_proc_per_machine, |
| 335 | suffix_optional_envvars=suffix_optional_envvars, |
| 336 | ) |
| 337 | |
| 338 | |
| 339 | def wrap_cmd_with_local_envvars(cmd: str, env_vars: str) -> str: |