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
Installation
dagger install github.com/dciangot/daggerverse/shadeform@f0185187d0832b19d69a0d4cf074029da331f645
Entrypoint
Return Type
Shadeform !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | No description provided |
shadeToken | Secret ! | - | A reference to a secret value, which can be handled more safely than the value itself. |
vmId | String | - | No description provided |
sshKey | File | - | No description provided |
cache | CacheVolume | - | No description provided |
templateFile | File | - | No description provided |
Example
func (m *myModule) 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
func (m *myModule) example(name string, shadeToken *Secret) *Container {
return dag.
Shadeform(name, shadeToken).
Client()
}
createVm() 🔗
Returns a container executing all the needed steps for creating a machine starting from passed parameters
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cloud | String ! | - | No description provided |
region | String ! | - | No description provided |
shadeInstanceType | String ! | - | No description provided |
shadeCloud | String ! | - | No description provided |
Example
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)
}
getVmId() 🔗
Return the VM ID
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
GetVmId(ctx)
}
getVmInfo() 🔗
Return the VM info JSON
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
GetVmInfo(ctx)
}
getAvailableList() 🔗
Return a list of available instances with the indicated boards sorted by price
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
gpuType | String ! | - | No description provided |
nGpus | Integer ! | - | No description provided |
Example
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)
}
getVmStatus() 🔗
Print the VM status
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
GetVmStatus(ctx)
}
getVmIp() 🔗
Print the VM IP
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
GetVmIp(ctx)
}
getVmUser() 🔗
Print the VM user to use for SSH connection
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
GetVmUser(ctx)
}
vmReady() 🔗
Wait for VM to be ready and return its ID
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
maxRetries | Integer ! | 10 | No description provided |
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret, maxRetries int) string {
return dag.
Shadeform(name, shadeToken).
VmReady(ctx, maxRetries)
}
createNcheck() 🔗
Create a VM and wait for its creation to succeed
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cloud | String ! | "hyperstack" | No description provided |
region | String ! | "canada-1" | No description provided |
shadeInstanceType | String ! | "A6000" | No description provided |
shadeCloud | String ! | "true" | No description provided |
Example
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)
}
deleteVm() 🔗
Delete VM
Return Type
String !
Example
func (m *myModule) example(ctx context.Context, name string, shadeToken *Secret) string {
return dag.
Shadeform(name, shadeToken).
DeleteVm(ctx)
}
execSshCommand() 🔗
execute the provided through automatic ssh command
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
command | String ! | - | No description provided |
sshKey | File ! | - | A file. |
Example
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)
}
copyFile() 🔗
Copy a local file to the remote VM
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
sshKey | File ! | - | A file. |
file | File ! | - | A file. |
destination | String ! | - | No description provided |
Example
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)
}
copyDir() 🔗
Copy a local directory to the remote VM
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
sshKey | File ! | - | A file. |
dir | Directory ! | - | A directory. |
destination | String ! | - | No description provided |
Example
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)
}