gigl.src.common.custom_launcher#

Subprocess dispatch for CustomLauncherConfig-backed launchers.

Takes CustomLauncherConfig.command and CustomLauncherConfig.args verbatim and shells out via subprocess.run(shell_line, shell=True). The shell-style invocation honors leading KEY=VALUE env-var assignments in command so callers can self-document required env without forcing the dispatcher to parse env separately.

The receiving subprocess has no special protocol — it is expected to be a plain CLI that argparses whatever flags the YAML wires up via args[]. The dispatcher performs no template substitution; any dynamic content (runtime URIs, image refs, etc.) is the caller’s responsibility — typically resolved at YAML-load time before the proto reaches this module.

The dispatcher exports its context args as GIGL_* environment variables on the subprocess env (see gigl.env.constants) so receiving CLIs can os.environ.get(...) whatever runtime context they need. The parent process’s os.environ is never mutated; the GIGL_* keys live only in the per-call env passed to subprocess.run.

Attributes#

Functions#

launch_custom(custom_launcher_config, ...)

Shell out to custom_launcher_config.command with args[] appended.

Module Contents#

gigl.src.common.custom_launcher.launch_custom(custom_launcher_config, applied_task_identifier, task_config_uri, resource_config_uri, cpu_docker_uri, cuda_docker_uri, component)[source]#

Shell out to custom_launcher_config.command with args[] appended.

Composes a shell line as command followed by each args[] element passed through shlex.quote, then invokes subprocess.run(shell_line, shell=True, check=True, env=env).

The dispatcher takes command and args[] verbatim — no template substitution of any kind. Any placeholder text in those fields reaches subprocess.run literally; consumers that want substitution should resolve it at YAML-load time before the proto reaches this module.

The subprocess env is built per-call from os.environ.copy() plus the GIGL_* keys defined in gigl.env.constants. The parent process’s os.environ is never mutated. When None is passed for cpu_docker_uri / cuda_docker_uri, the corresponding env var falls back to gigl.common.constants.DEFAULT_GIGL_RELEASE_SRC_IMAGE_CPU / gigl.common.constants.DEFAULT_GIGL_RELEASE_SRC_IMAGE_CUDA so receivers always observe a usable image URI.

Parameters:
  • custom_launcher_config (snapchat.research.gbml.gigl_resource_config_pb2.CustomLauncherConfig) – Proto whose command is the shell snippet to execute and whose args are positional arguments appended verbatim.

  • applied_task_identifier (str) – Exported to the subprocess as GIGL_APPLIED_TASK_IDENTIFIER.

  • task_config_uri (gigl.common.Uri) – Exported to the subprocess as GIGL_TASK_CONFIG_URI (stringified).

  • resource_config_uri (gigl.common.Uri) – Exported to the subprocess as GIGL_RESOURCE_CONFIG_URI (stringified).

  • cpu_docker_uri (Optional[str]) – Exported as GIGL_CPU_DOCKER_URI. Falls back to DEFAULT_GIGL_RELEASE_SRC_IMAGE_CPU when None.

  • cuda_docker_uri (Optional[str]) – Exported as GIGL_CUDA_DOCKER_URI. Falls back to DEFAULT_GIGL_RELEASE_SRC_IMAGE_CUDA when None.

  • component (gigl.src.common.constants.components.GiGLComponents) – Which GiGL component is being launched. Must be in _LAUNCHABLE_COMPONENTS. Exported as GIGL_COMPONENT using component.name (e.g. "Trainer").

Raises:
  • ValueError – If component is not Trainer or Inferencer, or if custom_launcher_config.command is empty.

  • subprocess.CalledProcessError – If the spawned subprocess exits non-zero.

Return type:

None

gigl.src.common.custom_launcher.logger[source]#