batch

package
v0.0.0-...-86c76a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAzureBatchAccount

func CreateAzureBatchAccount(ctx context.Context, accountName, location, resourceGroupName string) (a batchARM.Account, err error)

CreateAzureBatchAccount creates a new azure batch account

Example
var groupName = config.GenerateGroupName("Batch")
config.SetGroupName(groupName)
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Minute*30))
defer cancel()
defer resources.Cleanup(ctx)

_, err := resources.CreateGroup(ctx, config.GroupName())
if err != nil {
	util.PrintAndLog(err.Error())
}

_, err = CreateAzureBatchAccount(ctx, accountName, config.Location(), config.GroupName())
if err != nil {
	util.PrintAndLog(err.Error())
	return
}
util.PrintAndLog("created batch account")

err = CreateBatchPool(ctx, accountName, config.Location(), poolID)
if err != nil {
	util.PrintAndLog(err.Error())
	return
}
util.PrintAndLog("created batch pool")

err = CreateBatchJob(ctx, accountName, config.Location(), poolID, jobID)
if err != nil {
	util.PrintAndLog(err.Error())
	return
}
util.PrintAndLog("created batch job")

taskID, err := CreateBatchTask(ctx, accountName, config.Location(), jobID)
if err != nil {
	util.PrintAndLog(err.Error())
	return
}
util.PrintAndLog("created batch task")

taskOutput, err := WaitForTaskResult(ctx, accountName, config.Location(), jobID, taskID)
if err != nil {
	util.PrintAndLog(err.Error())
	return
}
util.PrintAndLog("output from task:")
util.PrintAndLog(taskOutput)
Output:

created batch account
created batch pool
created batch job
created batch task
output from task:
Hello world from the Batch Hello world sample!

func CreateBatchJob

func CreateBatchJob(ctx context.Context, accountName, accountLocation, poolID, jobID string) error

CreateBatchJob create an azure batch job

func CreateBatchPool

func CreateBatchPool(ctx context.Context, accountName, accountLocation, poolID string) error

CreateBatchPool creates an Azure Batch compute pool

func CreateBatchTask

func CreateBatchTask(ctx context.Context, accountName, accountLocation, jobID string) (string, error)

CreateBatchTask create an azure batch job

func WaitForTaskResult

func WaitForTaskResult(ctx context.Context, accountName, accountLocation, jobID, taskID string) (stdout string, err error)

WaitForTaskResult polls the task and retreives it's stdout once it has completed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL