genvid.toolbox.SDK

class genvid.toolbox.SDK(cluster_id='local', **kwargs)

Bases: genvid.toolbox.aws.AWSTool, genvid.toolbox.vault.VaultTool

Common commands for setting up the SDK.

This class wraps the ClusterAPI and BastionAPI for setting up a new Genvid SDK into the current cluster.

NAME = 'sdk'
SDK_CONFIG_VERSION = '1.7.0'
bastionAPI = None

Interface to the Bastion-API instance.

clean()

Stops the base SDK services.

clean_config()

Clean the configuration.

clean_images(bucket=None, path: str = '/images/custom', update_config: bool = True)

Remove all images in the bucket.

Parameters:bucket – The name of the bucket. Defaults to the return of get_s3_bucket_id(). :param path: The prefix key in the bucket for the images. :param update_config: Update the configuration. Requires a non-local cluster.

Changed in version 1.14.0: Change the default path from ‘/’ to ‘/images/custom’.

clusterAPI = None

Interface to the cluster Cluster-API instance.

cluster_id = None

The Cluster ID.

cluster_vault_secret = None

Key in the bastion’s Vault where the cluster vault keys are saved.

get_config() → dict

Get the current cluster configuration.

get_images_config(bucket=None, path='/images/custom') → dict

Get the image configuration from the cloud.

The image name must match DockerTool.RE_IMAGE_IMAGEID.

Parameters:
  • bucket – The bucket to use. Defaults to get_s3_bucket_id().
  • path – The path for the bucket. Defaults to ‘/images/custom’.

Changed in version 1.14.0: Changed the default path from ‘/’ to ‘/images/custom’.

get_remote_cluster_conn()

Return the cluster IP and private key.

get_remote_cluster_secrets()

Returns the cluster vault initialization secrets.

get_s3_bucket_id()

Get the S3 bucket ID for images.

get_sdk_config() → dict

Get the default SDK configuration.

is_jobs_running()

Return True if a job is configured to be running.

classmethod merge_dict(source, destination)

Merge 2 dictionaries.

Parameters:
  • source – The source dictionary.
  • destination – The destination dictionary.
remove_config(config: dict)

Remove values from the configuration. :param config: The configuration to remove values from.

set_config(config: dict = None)

Merge the specified configuration with the current one. :param config: The configuration to merge.

setup(bucket: str = None, path: str = '/')

Starts the base SDK services.

Parameters:
  • bucket – The name of the bucket. Defaults to the return of get_s3_bucket_id().
  • path – The prefix key in the bucket for the images.
start_jobs(jobs: typing.Union[typing.List[str], NoneType] = None)

Start all jobs or the specified job. :param jobs: The list of jobs to start.

stop_jobs(jobs: typing.Union[typing.List[str], NoneType] = None)

Stop all jobs or the specified job.

Parameters:jobs – The list of jobs to stop.
update_config(config: dict = None)

Update the specified configuration.

Parameters:config – The configuration to update.
Returns:The updated configuration.
upload_images(prefixes: typing.List[str], bucket=None, path='/images/custom', update_config=True)

Upload the images with the specified prefixes. The image names must match DockerTool.RE_IMAGE_IMAGEID.

Parameters:
  • prefixes – Upload only files with these prefixes.
  • bucket – The name of the bucket. Default to the return of get_s3_bucket_id().
  • path – The prefix key in the bucket for the images.
  • update_config – Update the configuration. Requires a non-local cluster.
upload_images_sdk(bucket=None, path=None, update_config=True)

Upload the images for the SDK.

Changed in version 1.14.0: Default path changes from ‘/’ to ‘/images/sdk-{version}/