Dagger
Search

shadeform

Dagger module to manage the lifecycle of a Shadeform VM. Handy for integration in data-science pipelines or in any DAG graph when one or more tasks can benefit from the execution on a GPU machine. See examples for a demonstration on how to use it

Example
no available example in current language
no available example in current language
async def shadeform(
        self,
        name: str,
        shade_token: dagger.Secret,
        ssh_key: dagger.File,
        install_script: dagger.File,
        interlink_key: dagger.File,
        interlink_endpoint: str,
        interlink_port: int
    ) -> str:
    """
    Demo creating a VM and install software (e.g. interlink) and launching deamons
    """
    cloud = "hyperstack"
    region = "canada-1"
    shade_instance_type = "A6000"
    shade_cloud = "true"
    
    # Create a VM and wait for it to be ready
    await (
        dag.shadeform(name, shade_token)
        .create_n_check(
            cloud=cloud,
            region=region,
            shade_instance_type=shade_instance_type,
            shade_cloud=shade_cloud)
    )
    #time.sleep(120)
    # Copy the local install script on the VM
    print (
        await (
            dag.shadeform(name, shade_token)
            .copy_file(
                ssh_key=ssh_key,
                file=install_script,
                destination="/tmp/install.sh"
            )
        )
    )
    # Copy additional files
    print( 
        await (
            dag.shadeform(name, shade_token)
            .copy_file(
                ssh_key=ssh_key,
                file=interlink_key,
                destination="/tmp/ssh.key"
            )
        )
    )
    # Execute the installation script
    return await (
        dag.shadeform(name, shade_token)
        .exec_ssh_command(
            ssh_key=ssh_key,
            command=f"bash -c \"/tmp/install.sh start /tmp/ssh.key {interlink_endpoint} {interlink_port}\""
        )
    )
no available example in current language
Example (delete_vm)
no available example in current language
no available example in current language
async def shadeform__delete_vm(
        self,
        name: str,
        shade_token: dagger.Secret,
    ) -> str:
    """
    This is an example of deleting a VM
    """
    return await (
        dag.shadeform(name, shade_token)
        .delete_vm()
    )
no available example in current language
Example (create_n_check)
no available example in current language
no available example in current language
async def shadeform__create_n_check(
        self,
        name: str,
        shade_token: dagger.Secret,
    ) -> str:
    """
    This is an example of creating a VM and checking when done
    """
    cloud = "imwt"
    region = "us-central-2"
    shade_instance_type = "A6000"
    shade_cloud = "true"
    return await (
        dag.shadeform(name, shade_token)
        .create_n_check(
            cloud=cloud,
            region=region,
            shade_instance_type=shade_instance_type,
            shade_cloud=shade_cloud)
    )
no available example in current language

Installation

dagger install github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11

Entrypoint

Return Type
Shadeform !
Arguments
NameTypeDescription
nameString !No description provided
shadeTokenSecret !A reference to a secret value, which can be handled more safely than the value itself.
vmIdString No description provided
sshKeyFile No description provided
cacheCacheVolume No description provided
templateFileFile No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET
func (m *myModule) example(name string, shadeToken *Secret) *Shadeform  {
	return dag.
			Shadeform(name, shadeToken)
}
@function
def example(name: str, shade_token: dagger.Secret, ) -> dag.Shadeform:
	return (
		dag.shadeform(name, shade_token)
	)
@func()
example(name: string, shadeToken: Secret, ): Shadeform {
	return dag
		.shadeform(name, shadeToken)
}

Types

Shadeform 🔗

client() 🔗

Return a CURL debug client with cache (vm information) mounted.

Return Type
Container !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET client
func (m *myModule) example(name string, shadeToken *Secret) *Container  {
	return dag.
			Shadeform(name, shadeToken).
			Client()
}
@function
def example(name: str, shade_token: dagger.Secret, ) -> dagger.Container:
	return (
		dag.shadeform(name, shade_token)
		.client()
	)
@func()
example(name: string, shadeToken: Secret, ): Container {
	return dag
		.shadeform(name, shadeToken)
		.client()
}

exists() 🔗

Return Type
Void !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET exists
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret)   {
	return dag.
			Shadeform(name, shadeToken).
			Exists(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> None:
	return await (
		dag.shadeform(name, shade_token)
		.exists()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<void> {
	return dag
		.shadeform(name, shadeToken)
		.exists()
}

createVm() 🔗

Returns a container executing all the needed steps for creating a machine starting from passed parameters

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
cloudString !-No description provided
regionString !-No description provided
shadeInstanceTypeString !-No description provided
shadeCloudString !-No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET create-vm --cloud string --region string --shade-instance-type string --shade-cloud string
func (m *myModule) example(name string, shadeToken *Secret, cloud string, region string, shadeInstanceType string, shadeCloud string) *Container  {
	return dag.
			Shadeform(name, shadeToken).
			CreateVm(cloud, region, shadeInstanceType, shadeCloud)
}
@function
def example(name: str, shade_token: dagger.Secret, cloud: str, region: str, shade_instance_type: str, shade_cloud: str) -> dagger.Container:
	return (
		dag.shadeform(name, shade_token)
		.create_vm(cloud, region, shade_instance_type, shade_cloud)
	)
@func()
example(name: string, shadeToken: Secret, cloud: string, region: string, shadeInstanceType: string, shadeCloud: string): Container {
	return dag
		.shadeform(name, shadeToken)
		.createVm(cloud, region, shadeInstanceType, shadeCloud)
}

getVmId() 🔗

Return the VM ID

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-vm-id
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetVmId(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_vm_id()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getVmId()
}

getVmInfo() 🔗

Return the VM info JSON

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-vm-info
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetVmInfo(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_vm_info()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getVmInfo()
}

getAvailableList() 🔗

Return a list of available instances with the indicated boards sorted by price

Return Type
String !
Arguments
NameTypeDefault ValueDescription
gpuTypeString !-No description provided
nGpusInteger !-No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-available-list --gpu-type string --n-gpus integer
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, gpuType string, nGpus int) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetAvailableList(ctx, gpuType, nGpus)
}
@function
async def example(name: str, shade_token: dagger.Secret, gpu_type: str, n_gpus: int) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_available_list(gpu_type, n_gpus)
	)
@func()
async example(name: string, shadeToken: Secret, gpuType: string, nGpus: number): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getAvailableList(gpuType, nGpus)
}

getVmStatus() 🔗

Print the VM status

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-vm-status
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetVmStatus(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_vm_status()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getVmStatus()
}

getVmIp() 🔗

Print the VM IP

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-vm-ip
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetVmIp(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_vm_ip()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getVmIp()
}

getVmUser() 🔗

Print the VM user to use for SSH connection

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET get-vm-user
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			GetVmUser(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.get_vm_user()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.getVmUser()
}

vmReady() 🔗

Wait for VM to be ready and return its ID

Return Type
String !
Arguments
NameTypeDefault ValueDescription
maxRetriesInteger !10No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET vm-ready --max-retries integer
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, maxRetries int) string  {
	return dag.
			Shadeform(name, shadeToken).
			VmReady(ctx, maxRetries)
}
@function
async def example(name: str, shade_token: dagger.Secret, max_retries: int) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.vm_ready(max_retries)
	)
@func()
async example(name: string, shadeToken: Secret, maxRetries: number): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.vmReady(maxRetries)
}

createNcheck() 🔗

Create a VM and wait for its creation to succeed

Return Type
String !
Arguments
NameTypeDefault ValueDescription
cloudString !"hyperstack"No description provided
regionString !"canada-1"No description provided
shadeInstanceTypeString !"A6000"No description provided
shadeCloudString !"true"No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET create-n-check --cloud string --region string --shade-instance-type string --shade-cloud string
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, cloud string, region string, shadeInstanceType string, shadeCloud string) string  {
	return dag.
			Shadeform(name, shadeToken).
			CreateNCheck(ctx, cloud, region, shadeInstanceType, shadeCloud)
}
@function
async def example(name: str, shade_token: dagger.Secret, cloud: str, region: str, shade_instance_type: str, shade_cloud: str) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.create_n_check(cloud, region, shade_instance_type, shade_cloud)
	)
@func()
async example(name: string, shadeToken: Secret, cloud: string, region: string, shadeInstanceType: string, shadeCloud: string): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.createNCheck(cloud, region, shadeInstanceType, shadeCloud)
}

deleteVm() 🔗

Delete VM

Return Type
String !
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET delete-vm
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string  {
	return dag.
			Shadeform(name, shadeToken).
			DeleteVm(ctx)
}
@function
async def example(name: str, shade_token: dagger.Secret, ) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.delete_vm()
	)
@func()
async example(name: string, shadeToken: Secret, ): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.deleteVm()
}

execSshCommand() 🔗

execute the provided through automatic ssh command

Return Type
String !
Arguments
NameTypeDefault ValueDescription
commandString !-No description provided
sshKeyFile !-A file.
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET exec-ssh-command --command string --ssh-key file:path
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, command string, sshKey *File) string  {
	return dag.
			Shadeform(name, shadeToken).
			ExecSshCommand(ctx, command, sshKey)
}
@function
async def example(name: str, shade_token: dagger.Secret, command: str, ssh_key: dagger.File) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.exec_ssh_command(command, ssh_key)
	)
@func()
async example(name: string, shadeToken: Secret, command: string, sshKey: File): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.execSshCommand(command, sshKey)
}

copyFile() 🔗

Copy a local file to the remote VM

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sshKeyFile !-A file.
fileFile !-A file.
destinationString !-No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET copy-file --ssh-key file:path --file file:path --destination string
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, sshKey *File, file *File, destination string) string  {
	return dag.
			Shadeform(name, shadeToken).
			CopyFile(ctx, sshKey, file, destination)
}
@function
async def example(name: str, shade_token: dagger.Secret, ssh_key: dagger.File, file: dagger.File, destination: str) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.copy_file(ssh_key, file, destination)
	)
@func()
async example(name: string, shadeToken: Secret, sshKey: File, file: File, destination: string): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.copyFile(sshKey, file, destination)
}

copyDir() 🔗

Copy a local directory to the remote VM

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sshKeyFile !-A file.
dirDirectory !-A directory.
destinationString !-No description provided
Example
dagger -m github.com/dciangot/daggerverse/shadeform@8dcb7ccd5a38bbe87f77b0ebe7b70aebd48eea11 call \
 --name string --shade-token env:MYSECRET copy-dir --ssh-key file:path --dir DIR_PATH --destination string
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, sshKey *File, dir *Directory, destination string) string  {
	return dag.
			Shadeform(name, shadeToken).
			CopyDir(ctx, sshKey, dir, destination)
}
@function
async def example(name: str, shade_token: dagger.Secret, ssh_key: dagger.File, dir: dagger.Directory, destination: str) -> str:
	return await (
		dag.shadeform(name, shade_token)
		.copy_dir(ssh_key, dir, destination)
	)
@func()
async example(name: string, shadeToken: Secret, sshKey: File, dir: Directory, destination: string): Promise<string> {
	return dag
		.shadeform(name, shadeToken)
		.copyDir(sshKey, dir, destination)
}