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

Function wrap_cmd_with_extra_envvars

tools/distgraphlaunch.py:365–382  ·  view source on GitHub ↗

Wraps a CLI command with extra env vars Example: >>> cmd = "ls && pwd" >>> env_vars = ["VAR1=value1", "VAR2=value2"] >>> wrap_cmd_with_extra_envvars(cmd, env_vars) "(export VAR1=value1 VAR2=value2; ls && pwd)" Args: cmd: env_vars: A list of s

(cmd: str, env_vars: list)

Source from the content-addressed store, hash-verified

363
364
365def wrap_cmd_with_extra_envvars(cmd: str, env_vars: list) -> str:
366 """Wraps a CLI command with extra env vars
367
368 Example:
369 >>> cmd = "ls && pwd"
370 >>> env_vars = ["VAR1=value1", "VAR2=value2"]
371 >>> wrap_cmd_with_extra_envvars(cmd, env_vars)
372 "(export VAR1=value1 VAR2=value2; ls && pwd)"
373
374 Args:
375 cmd:
376 env_vars: A list of strings containing env vars, e.g., ["VAR1=value1", "VAR2=value2"]
377
378 Returns:
379 cmd_with_env_vars:
380 """
381 env_vars = " ".join(env_vars)
382 return wrap_cmd_with_local_envvars(cmd, env_vars)
383
384
385def submit_jobs(args, udf_command):

Callers

nothing calls this directly

Calls 2

joinMethod · 0.45

Tested by

no test coverage detected