genvid.toolbox.SDK

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

Bases: genvid.toolbox.aws.AWSTool

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'
clean()

Stops the base SDK services.

clean_config()

Clean the configuration.

clean_images(bucket=None, path: str = '/', 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().
  • path – The prefix key in the bucket for the images.
  • update_config – Update the configuration. Requires a non-local cluster.
get_config() → dict

Get the current cluster configuration.

get_images_config(bucket=None, path='/') → 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 ‘/’.
get_s3_bucket_id()

Get the S3 bucket ID.

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. :param jobs: The list of jobs to stop.

update_config(config: dict = None)

Update the specified configuration. :param config: The configuration to update. :return: The updated configuration.

upload_images(prefixes: typing.List[str], bucket=None, path='/', 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='/', update_config=True)

Upload the images for the SDK.