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
andBastionAPI
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 = '/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’.
-
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’.
- bucket – The bucket to use. Defaults to
-
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.
- bucket – The name of the bucket. Defaults to the return of
-
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}/
-