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 jobimage_name(str, required): Docker image to run for the jobcpu(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 mountvolume_full_path(str): Mount path for volumesstartup_command(str): Override container entrypoint commandrepository_secret(str): Secret for private container registriescgc_data(list[str]): CGC-specific configuration dataenvironment_data(list[str]): Environment variables as "KEY=value"arguments_data(list[str]): Command line arguments for the jobconfig_maps_data(list): ConfigMap configurationsttl_seconds_after_finished(Optional[int]): Time to live in seconds after job completion
Returns:
dict: Response with job creation statuscode: HTTP status codedetails: Job creation details
Raises:
SDKException: With code -2 if image_name is missingSDKException: 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 jobscode: HTTP status codedetails: 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 statuscode: HTTP status codedetails: Job deletion details