MCPcopy
hub / github.com/dmlc/dgl / construct_dgl_server_env_vars

Function construct_dgl_server_env_vars

tools/distgraphlaunch.py:305–336  ·  view source on GitHub ↗

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] = "",
)

Source from the content-addressed store, hash-verified

303
304
305def 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
339def wrap_cmd_with_local_envvars(cmd: str, env_vars: str) -> str:

Callers 1

submit_jobsFunction · 0.70

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected