common

package
v0.0.0-...-2ccd479 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMPUTE_CPU_GPU = iota // 0
	COMPUTE_CPU            // 1
	COMPUTE_GPU            // 2
)

ComputeType enum https://golang.org/ref/spec#Iota

View Source
const (
	// id have to be kept synchronised with the server side.
	OK                           = 0
	WRONG_CONFIGURATION          = 1
	AUTHENTICATION_FAILED        = 2
	TOO_OLD_CLIENT               = 3
	SESSION_DISABLED             = 4
	RENDERER_NOT_AVAILABLE       = 5
	MISSING_RENDER               = 6
	MISSING_SCENE                = 7
	NOOUTPUTFILE                 = 8
	DOWNLOAD_FILE                = 9
	CAN_NOT_CREATE_DIRECTORY     = 10
	NETWORK_ISSUE                = 11
	RENDERER_CRASHED             = 12
	RENDERER_OUT_OF_VIDEO_MEMORY = 13

	RENDERER_KILLED            = 14
	RENDERER_MISSING_LIBRARIES = 15
	FAILED_TO_EXECUTE          = 16
	OS_NOT_SUPPORTED           = 17
	CPU_NOT_SUPPORTED          = 18
	GPU_NOT_SUPPORTED          = 19
	RENDERER_KILLED_BY_USER    = 20
	RENDERER_OUT_OF_MEMORY     = 21
	RENDERER_KILLED_BY_SERVER  = 22

	// internal error handling
	UNKNOWN                 = 99
	NO_SPACE_LEFT_ON_DEVICE = 100
	ERROR_BAD_RESPONSE      = 101
)

public enum Type

View Source
const (
	SERVER_OK      = 0
	SERVER_UNKNOWN = 999

	CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN = 100
	CONFIGURATION_ERROR_CLIENT_TOO_OLD          = 101
	CONFIGURATION_ERROR_AUTH_FAILED             = 102
	CONFIGURATION_ERROR_WEB_SESSION_EXPIRED     = 103
	CONFIGURATION_ERROR_MISSING_PARAMETER       = 104

	JOB_REQUEST_NOJOB                        = 200
	JOB_REQUEST_ERROR_NO_RENDERING_RIGHT     = 201
	JOB_REQUEST_ERROR_DEAD_SESSION           = 202
	JOB_REQUEST_ERROR_SESSION_DISABLED       = 203
	JOB_REQUEST_ERROR_INTERNAL_ERROR         = 204
	JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE = 205
	JOB_REQUEST_SERVER_IN_MAINTENANCE        = 206
	JOB_REQUEST_SERVER_OVERLOADED            = 207

	JOB_VALIDATION_ERROR_MISSING_PARAMETER  = 300
	JOB_VALIDATION_ERROR_BROKEN_MACHINE     = 301 // in GPU the generated frame is black
	JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE = 302
	JOB_VALIDATION_ERROR_UPLOAD_FAILED      = 303
	JOB_VALIDATION_ERROR_SESSION_DISABLED   = 304 // missing heartbeat or broken machine

	KEEPMEALIVE_STOP_RENDERING = 400

	// internal error handling
	SERVER_ERROR_NO_ROOT        = 2
	SERVER_ERROR_BAD_RESPONSE   = 3
	SERVER_ERROR_REQUEST_FAILED = 5
)

public enum ServerCode

Variables

This section is empty.

Functions

func ErrorAsString

func ErrorAsString(in int) string

func ServerCodeToError

func ServerCodeToError(sc int) int

Types

type ComputeType

type ComputeType int

func (*ComputeType) UnmarshalText

func (d *ComputeType) UnmarshalText(text []byte) error

type Configuration

type Configuration struct {
	Server   string
	Proxy    string
	Login    string
	Password string `json:"-"`

	// Used for initialisation only
	CacheDir string `toml:"cache-dir"`

	// Directory containing downloaded project files. Default /tmp
	ProjectDir string `toml:"project-dir"`

	// Directory containing downloaded renderers. Default ~/.sheepit/
	StorageDir string `toml:"storage-dir"`

	MaxUploadingJob int
	Gpu             string      `toml:"compute-gpu"` // TODO: calculate GPU device from interrogation of CUDA lib; OS-specific
	ComputeMethod   ComputeType `toml:"compute-method"`

	// Total cores to use when rendering. Default all available cores.
	UseCores int `toml:"cores"`

	// Times during which SheepIt will request new jobs
	RequestTime []time.Time

	// ??
	Extras string

	// Process priority for rendering
	Priority int

	TileSize int `toml:"tile-size"`
}

func (*Configuration) Merge

func (c *Configuration) Merge(other Configuration)

func (*Configuration) SetComputeMethod

func (c *Configuration) SetComputeMethod(method string)

Given a string representation of the COMPUTE_ consts, convert to value For example, "CPU" -> const COMPUTE_CPU -> 1

func (*Configuration) SetDefaults

func (c *Configuration) SetDefaults()

After setting up Configuration struct, call SetDefaults() to ensure remaining defaults are correctly configured (e.g. working directories)

func (*Configuration) SetGpuDevice

func (c *Configuration) SetGpuDevice(gpu string)

Take a string such as "CUDA_0" and determine actual hardware capabilities from CUDA lib

type FileArchive

type FileArchive interface {
	// MD5 hash that the archive should match
	GetExpectedHash() string

	// Usually RootPath/<hash>.zip
	GetArchivePath() string

	// Usually RootPath/<hash/*.*
	GetContentPath() string
}

type Job

type Job struct {
	ArchiveMd5        string `xml:"archive_md5,attr"`
	Id                int    `xml:"id,attr"`
	UseGpu            bool   `xml:"use_gpu,attr"`
	Path              string `xml:"path,attr"`
	Frame             int    `xml:"frame,attr"`
	SynchronousUpload bool   `xml:"synchronous_upload,attr"`
	Extras            string `xml:"extras,attr"`
	Name              string `xml:"name,attr"`
	Password          string `xml:"password,attr"`

	Renderer *Renderer `xml:"renderer"`
	Script   string    `xml:"script"`

	RootPath string
}

func (*Job) Cancel

func (j *Job) Cancel()

func (Job) GetArchivePath

func (j Job) GetArchivePath() string

func (Job) GetContentPath

func (j Job) GetContentPath() string

func (Job) GetExpectedHash

func (j Job) GetExpectedHash() string

FileArchive interface

func (*Job) Render

func (j *Job) Render(device hardware.Computer, config Configuration) (string, error)

type Renderer

type Renderer struct {
	ArchiveMd5   string `xml:"md5,attr"`
	Command      string `xml:"commandline,attr"`
	UpdateMethod string `xml:"update_method,attr"`

	ElapsedDuration   time.Duration
	RemainingDuration time.Duration

	RootPath string
}

func (Renderer) GetArchivePath

func (r Renderer) GetArchivePath() string

func (Renderer) GetContentPath

func (r Renderer) GetContentPath() string

func (Renderer) GetExpectedHash

func (r Renderer) GetExpectedHash() string

FileArchive interface

Jump to

Keyboard shortcuts

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