inmap: github.com/spatialmodel/inmap/cloud Index | Files | Directories

package cloud

import "github.com/spatialmodel/inmap/cloud"

Package cloud contains utilities for distributed InMAP simulations.

Index

Package Files

blob.go bucket.go client.go config.go fakerunner.go gendoc.go jobspec.go

func JobSpec Uses

func JobSpec(root *cobra.Command, config *viper.Viper, name string, cmdArgs, inputFiles []string, memoryGB int32) (*cloudrpc.JobSpec, error)

JobSpec initializes a cloudrpc.JobSpec object from the given configuration information. memoryGB and storageGB are the required amounts of RAM and hard-disk storage, respectively, in gigabytes. name is the user-specified job name, cmdArgs is a list of InMAP sub-commands (e.g., "run steady"), and inputFiles is a list of the configuration arguments that represent input files.

func OpenBucket Uses

func OpenBucket(ctx context.Context, bucketName string) (*blob.Bucket, error)

OpenBucket returns the blob storage bucket specified by bucketName, where bucketName must be in the format 'provider://name' where provider is the name of the storage provider and name is the name of the bucket. Even if name contains subdirectories, only the base directory name will be used when opening the bucket. The currently accepted storage providers are "file" for the local filesystem (e.g., for testing), "gs" for Google Cloud Storage, and "s3" for AWS S3.

type Client Uses

type Client struct {
    *grpcweb.WrappedGrpcServer

    kubernetes.Interface

    // Image holds the container image to be used.
    // The default is "inmap/inmap:latest".
    Image string

    // Volumes specifies any Kubernetes volumes that are to be
    // mounted in the containers that are created.
    // Each volume will be mounted at /data/volumeName
    // with read-only access.
    Volumes []core.Volume
    // contains filtered or unexported fields
}

Client is a Kubernetes client for InMAP.

func NewClient Uses

func NewClient(k kubernetes.Interface, root *cobra.Command, config *viper.Viper, bucketName string, inputFileArgs, outputFileArgs []string) (*Client, error)

NewClient creates a new distributed InMAP Kubernetes client. root is the root command to be run, config holds simulation configuration information, and bucketName is the name of a blob storage bucket for storing output files in the format gs://bucketname. inputFileArgs and outputFileArgs list the names of the configuration arguments that represent input and output files.

func NewFakeClient Uses

func NewFakeClient(checkConfig func([]string), checkRun func([]byte, error), bucket string, root *cobra.Command, config *viper.Viper, inputFileArgs, outputFileArgs []string) (*Client, error)

NewFakeClient creates a client for testing. Jobs that are created using this client are run locally. The InMAP command must be compiled for it to work, e.g., `go install github.com/spatialmodel/inmap/cmd/inmap`. The checkConfig and checkRun functions, if not nil, will be run before and after executing the inmap command, respectively.

func (*Client) Delete Uses

func (c *Client) Delete(ctx context.Context, job *cloudrpc.JobName) (*cloudrpc.JobName, error)

Delete deletes the given job.

func (*Client) Output Uses

func (c *Client) Output(ctx context.Context, job *cloudrpc.JobName) (*cloudrpc.JobOutput, error)

Output returns the output of the specified job.

func (*Client) RunJob Uses

func (c *Client) RunJob(ctx context.Context, job *cloudrpc.JobSpec) (*cloudrpc.JobStatus, error)

RunJob creates (and queues) a Kubernetes job with the given name that executes the given command with the given command-line arguments on the given container image. resources specifies the minimum required resources for execution.

func (*Client) Status Uses

func (c *Client) Status(ctx context.Context, job *cloudrpc.JobName) (*cloudrpc.JobStatus, error)

Status returns the status of the given job.

type FakeRPCClient Uses

type FakeRPCClient struct {
    Client *Client
}

FakeRPCClient is a local RPC client for testing.

func (FakeRPCClient) Delete Uses

func (c FakeRPCClient) Delete(ctx context.Context, job *cloudrpc.JobName, op ...grpc.CallOption) (*cloudrpc.JobName, error)

func (FakeRPCClient) Output Uses

func (c FakeRPCClient) Output(ctx context.Context, job *cloudrpc.JobName, op ...grpc.CallOption) (*cloudrpc.JobOutput, error)

func (FakeRPCClient) RunJob Uses

func (c FakeRPCClient) RunJob(ctx context.Context, job *cloudrpc.JobSpec, op ...grpc.CallOption) (*cloudrpc.JobStatus, error)

func (FakeRPCClient) Status Uses

func (c FakeRPCClient) Status(ctx context.Context, job *cloudrpc.JobName, op ...grpc.CallOption) (*cloudrpc.JobStatus, error)

Directories

PathSynopsis
cloudrpc
cloudrpc/cloudrpcgojsPackage cloudrpc is a generated protocol buffer package.

Package cloud imports 36 packages (graph) and is imported by 2 packages. Updated 2019-09-18. Refresh now. Tools for package owners.