Package: dl-cloud
Cloud Utilities for Deep Learning ⛅️A super lightweight cloud management tool designed with deep learning applications in mind.Built with the belief that managing cloud resources should be as easy as:importcloudcloud.connect()train_my_network()cloud.down()We welcome all contributions, suggestions, and use-cases. Reach out to us over GitHub or atteam@for.aiwith ideas!ContentsQuickstartInstallConfigUsageDocumentationAmazon EC2AzureGoogle CloudQuickstartInstall:Sort of stable:sudopipinstalldl-cloudBleeding edge:gitclonegit@github.com:for-ai/cloud.gitsudopipinstall-ecloudConfig:Seeconfigs/cloud.toml-*for instructions on how to authenticate for each provider (Google Cloud, AWS EC2, and Azure).Place your completed configuration file (namedcloud.toml) in either root/or$HOME. Otherwise, provide a full path to the file in$CLOUD_CFG.If you use GCP as a provider for yourcloud.tomlit will use GCP Instance metadata APIs to fetch APIs. If you want to configure for Google Cloud Build, please use;is_gcb=truezone='{{DESIRED_ZONE}}'Usage:GPUimportcloudcloud.connect()# gpu instances have a dedicated GPU so we don't need to worry# about preemption or acquiring/releasing accelerators online.whileTrue:# train your model or w/ecloud.down()# stop the instance (does not delete instance)TPU (Only on GCP)importcloudcloud.connect()tpu=cloud.instance.tpu.get(preemptible=True)# acquire an acceleratorwhileTrue:ifnottpu.usable:tpu.delete(background=True)# release the accelerator in the backgroundtpu=cloud.instance.tpu.get(preemptible=True)# acquire a new acceleratorelse:# train your model or w/ecloud.down()# release all resources, then stop the instance (does not delete instance)Documentationcloud.connect()Takes/Creates acloud.Instanceobject and setscloud.instanceto it.returnsdesc.cloud_enva cloud.Instance.cloud.down()Callscloud.instance.down().cloud.delete(confirm=True)Callscloud.instance.delete(confirm).cloud.ResourceTakes/Creates acloud.Instanceobject and setscloud.instanceto it.propertiesdesc.namestr, name of the instanceusablebool, whether this resource is usablemethodsdesc.up(background=False)start an existing stopped resourcedown(background=False)stop the resource. Note: this should not necessarily delete this resourcedelete(background=False)delete this resourcecloud.Instance(Resource)An object representing a cloud instance with a set of Resources that can be allocated/deallocated.propertiesdesc.resource_managerslist of ResourceManagersmethodsdesc.down(background=False, delete_resources=True)stop this instance and optionally delete all managed resourcesdelete(background=False, confirm=True)delete this instance with optional user confirmationcloud.ResourceManagerClass for managing the creation and maintanence ofcloud.Resources.propertiesdesc.instancecloud.Instanceinstance owning this resource managerresource_clscloud.Resourcetype, the class of the resource to be managedresourceslist ofcloud.Resources, managed resourcesmethodsdesc.__init__(instance, resource_cls)instance: thecloud.Instanceobject operating this ResourceManagerresource_cls: thecloud.Resourceclass this object managesadd(*args, **kwargs)add an existing resource to this managerremove(*args, **kwargs)remove an existing resource from this managerAmazon EC2cloud.AWSInstance(Instance)Acloud.Instanceobject for AWS EC2 instances.Azurecloud.AzureInstance(Instance)Acloud.Instanceobject for Microsoft Azure instances.Google CloudOur GCPInstance requires that your instances havegcloudinstalled and properly authenticated so thatgcloud alpha compute tpus create test_nameruns without issue.cloud.GCPInstance(Instance)Acloud.Instanceobject for Google Cloud instances.propertiesdesc.tpucloud.TPUManager, a resource manager for this instance's TPUsresource_managerslist of ownedcloud.ResourceManagersmethodsdesc.__init__(collect_existing_tpus=True, **kwargs)collect_existing_tpus: bool, whether to add existing TPUs to this manager**kwargs: passed tocloud.Instance's initializercloud.TPU(Resource)Resource class for TPU accelerators.propertiesdesc.ipstr, IP address of the TPUpreemptiblebool, whether this TPU is preemptible or notdetailsdict {str: str}, properties of this TPUmethodsdesc.up(background=False)start this TPUdown(background=False)stop this TPUdelete(background=False)delete this TPUcloud.TPUManager(ResourceManager)ResourceManager class for TPU accelerators.propertiesdesc.nameslist of str, names of the managed TPUsipslist of str, ips of the managed TPUsmethodsdesc.__init__(instance, collect_existing=True)instance: thecloud.GCPInstanceobject operating this TPUManagercollect_existing: bool, whether to add existing TPUs to this managerclean(background=True)delete all managed TPUs with unhealthy statesget(preemptible=True)get an available TPU, or create one usingup()if none existup(preemptible=True, background=False)allocate and manage a new instance ofresource_cls