Skip to main content

API reference

To work with the module: import cgc.sdk.job

job_create

Creates a new job to run a containerized workload.

Signature:

job_create(
name: str,
image_name: str,
cpu: int = 1,
memory: int = 2,
shm_size: int = 0,
gpu: int = 0,
gpu_type: str = "A5000",
volumes: list = [],
volume_full_path: str = "",
startup_command: str = "",
repository_secret: str = "",
cgc_data: list[str] = [],
environment_data: list[str] = [],
arguments_data: list[str] = [],
config_maps_data: list = [],
ttl_seconds_after_finished: Optional[int] = None
) -> dict

Parameters:

  • name (str, required): Unique name for the job
  • image_name (str, required): Docker image to run for the job
  • cpu (int): Number of CPU cores (default: 1)
  • memory (int): Memory in GB (default: 2)
  • shm_size (int): Shared memory size in GB (default: 0)
  • gpu (int): Number of GPUs (default: 0)
  • gpu_type (str): GPU type - A5000, A100, etc. (default: "A5000")
  • volumes (list): List of volume names to mount
  • volume_full_path (str): Mount path for volumes
  • startup_command (str): Override container entrypoint command
  • repository_secret (str): Secret for private container registries
  • cgc_data (list[str]): CGC-specific configuration data
  • environment_data (list[str]): Environment variables as "KEY=value"
  • arguments_data (list[str]): Command line arguments for the job
  • config_maps_data (list): ConfigMap configurations
  • ttl_seconds_after_finished (Optional[int]): Time to live in seconds after job completion

Returns:

  • dict: Response with job creation status
    • code: HTTP status code
    • details: Job creation details

Raises:

  • SDKException: With code -2 if image_name is missing
  • SDKException: With code -3 if invalid GPU type

job_list

Lists all jobs in the current context.

Signature:

job_list() -> dict

Returns:

  • dict: Response containing list of jobs
    • code: HTTP status code
    • details: Contains job information and status

job_delete

Deletes an existing job.

Signature:

job_delete(name: str) -> dict

Parameters:

  • name (str, required): Name of job to delete

Returns:

  • dict: Response with deletion status
    • code: HTTP status code
    • details: Job deletion details