Documentation
¶
Index ¶
- Constants
- Variables
- func HookOnJobCreate(hooks []string, j common.Job)
- func HookOnJobFinish(hooks []string, j common.Job)
- func HookOnJobStart(hooks []string, j common.Job)
- func HookOnQueueReorder(hooks []string, stack []common.Job)
- func HookOnResourceConnect(hooks []string, id string, r Resource)
- type HookJob
- type HookParameters
- type HookQueueOrder
- type HookQueueOrderJobData
- type HookResource
- type Queue
- func (q *Queue) ActiveTools() map[string]common.Tool
- func (q *Queue) AddJob(j common.Job) error
- func (q *Queue) AddResource(name string) (string, error)
- func (q *Queue) AddResourceManager(resmgr ResourceManager) error
- func (q *Queue) AllJobs() []common.Job
- func (q *Queue) AllJobsByResource(resourceid string) []common.Job
- func (q *Queue) AllResourceManagers() map[string]ResourceManager
- func (q *Queue) AllTools() map[string]common.Tool
- func (q *Queue) CheckResourceConnectionStatus(res *Resource) bool
- func (q *Queue) ConnectResource(resUUID, addr string, tlsconfig *tls.Config) error
- func (q *Queue) DeleteJobFromStackByIndex(idx int)
- func (q *Queue) GetResource(resUUID string) (*Resource, bool)
- func (q *Queue) GetResourceManager(systemname string) (ResourceManager, bool)
- func (q *Queue) JobInfo(jobUUID string) common.Job
- func (q *Queue) KeepAllResourceManagers()
- func (q *Queue) LoadRemoteResourceHardware(resUUID string)
- func (q *Queue) LoadRemoteResourceTools(resUUID string)
- func (q *Queue) PauseJob(jobuuid string) error
- func (q *Queue) PauseQueue() []error
- func (q *Queue) PauseResource(resUUID string) error
- func (q *Queue) Quit() []common.Job
- func (q *Queue) QuitJob(jobuuid string) error
- func (q *Queue) RemoveJob(jobuuid string) error
- func (q *Queue) RemoveResource(resUUID string) error
- func (q *Queue) ResumeQueue()
- func (q *Queue) ResumeResource(resUUID string) error
- func (q *Queue) StackReorder(uuids []string) error
- func (q *Queue) Types() []string
- type Resource
- type ResourceManager
- type ResourcePool
- type StateFile
- type Stats
Constants ¶
const ( STATUS_EMPTY = "Empty" STATUS_RUNNING = "Running" STATUS_PAUSED = "Paused" STATUS_EXHAUSTED = "Exhausted" )
Variables ¶
var KeeperDuration time.Duration
var NetworkTimeout time.Duration
var StateFileLocation string
Functions ¶
func HookOnJobFinish ¶
Runs when a job finishes no matter the status
func HookOnJobStart ¶
Runs on Job Start. Note: This is only when a job is initially started, * and will NOT pickup on pauses and restarts.
func HookOnQueueReorder ¶
Runs when the queue is reordered
func HookOnResourceConnect ¶
Runs when a resource is initially connected to the queue
Types ¶
type HookJob ¶
type HookJob struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status"` Owner string `json:"owner"` StartTime time.Time `json:"starttime"` CrackedHashes int64 `json:"crackedhashes"` TotalHashes int64 `json:"totalhashes"` Progress float64 `json:"progress"` Params map[string]string `json:"params"` ToolID string `json:"toolid"` PerformanceTitle string `json:"performancetitle"` PerformanceData map[string]string `json:"performancedata"` OutputTitles []string `json:"outputtitles"` OutputData [][]string `json:"outputdata"` }
Jobs structure for hook
type HookParameters ¶
type HookParameters struct { ScriptTimeout int JobCreate []string JobFinish []string JobStart []string ResourceConnect []string QueueReorder []string }
A struct that we can use as parameters to track our hooks from the configuration file down.
var Hooks HookParameters
type HookQueueOrder ¶
type HookQueueOrder struct {
JobOrder []HookQueueOrderJobData `json:"orderedjobs"`
}
type HookQueueOrderJobData ¶
type HookResource ¶
type HookResource struct { ID string `json:"id"` Name string `json:"name"` Address string `json:"address"` }
Resource structure to be used for hooks
type Queue ¶
func (*Queue) ActiveTools ¶
This function allows you to get tools that can actively have jobs created for them
func (*Queue) AddResource ¶
This function will add a resource to the queue. Returns the UUID.
func (*Queue) AddResourceManager ¶
func (q *Queue) AddResourceManager(resmgr ResourceManager) error
This function is used to add a resource manager to the map of all available managers and is used to add resourcemanager plugins during their creation.
func (*Queue) AllJobsByResource ¶
Get a list of all jobs assigned to a resource
func (*Queue) AllResourceManagers ¶
func (q *Queue) AllResourceManagers() map[string]ResourceManager
This function is used to gather all currently available resource managers and provide them back to the API or any other needed functions.
func (*Queue) CheckResourceConnectionStatus ¶
Checks to see if our RPC connection to a resource is still valid, if not it will return false, otherwise it will return true.
func (*Queue) ConnectResource ¶
This function will connect to a resource
func (*Queue) DeleteJobFromStackByIndex ¶
func (*Queue) GetResourceManager ¶
func (q *Queue) GetResourceManager(systemname string) (ResourceManager, bool)
This function will return a copy of a single resource manager from the Queue and all of the associated etails. It takes a parameter of the system name of the manager desired.
func (*Queue) KeepAllResourceManagers ¶
func (q *Queue) KeepAllResourceManagers()
This function will loop through all resource managers and executes thier keeper functions, causing them to update the status for all of their resources. The actions of each will be dependent on the resource manager.
func (*Queue) LoadRemoteResourceHardware ¶
This loads all of the hardware for a remote resource
func (*Queue) LoadRemoteResourceTools ¶
func (*Queue) PauseQueue ¶
Pause the whole queue and return any and all errors pausing active jobs/tasks
func (*Queue) PauseResource ¶
func (*Queue) RemoveResource ¶
RemoveResource closes the resource RPC client, and removes it from service. It does not delete it however, because that information is needed by the API even after it is no longer in service.
func (*Queue) ResumeQueue ¶
func (q *Queue) ResumeQueue()
func (*Queue) ResumeResource ¶
func (*Queue) StackReorder ¶
Given a new slice of the UUIDs for all jobs in order, reorder the stack
type Resource ¶
type Resource struct { Client *rpc.Client Name string Address string Hardware map[string]bool Tools map[string]common.Tool Status string // Can be running, paused, quit }
func NewResource ¶
func NewResource() Resource
type ResourceManager ¶
type ResourceManager interface { //SystemName returns the string used internally in the queue as a key. This //should only use characters that are valid inside a URL. SystemName() string //DisplayName returns a string for the name that should be presented to humans DisplayName() string //Description returns a string with a short description of the resource manager Description() string //Parameters returns a string containing JSON objects //with the necessary information to add a new resource using this manager. //It will need to be in the same format as the tool parameters, using the //format specified at http://schemaform.io. Consider that name and address //will be mandatory fields for when you add a resource, you may want to ask //for them, or you may want to generate them. ParametersForm() string ParametersSchema() string //AddResource takes a map of input (as required by parameters), the name and //address of the resource. Finally, it also takes a tls configuration that //will be required by the Queue to connect to the resource. It should then //add the resource to the queue itself for use by jobs. Can return an error //but that will be nil is there were no issues. AddResource(params map[string]string) error //DeleteResource will remove a resource from the queue as soon as it is able //pending job completion. Takes a parameter of the resource UUID and will //return an error if there are any problems. DeleteResource(resourceid string) error //GetResource takes the UUID of a resource in the queue and will return all //of the information about it in a queue.Resource object, as well as the //parameters that the resourcemanager is tracking internally. Can also return //an error if there are any problems. GetResource(resourceid string) (*Resource, map[string]string, error) //Update resource allows the API to change the status of an existing resource //or update the parameters internal to the resource manager. Address, name, //and other queue related resource data cannot be changed. UpdateResource(resourceid string, newstatus string, newparams map[string]string) error //GetManagedResources returns a slice of all resource UUIDs managed by this //resource manager. GetManagedResources() []string //Keep is a function that will be run on a regular basis (timing depends on //queue configuration, job status, etc.) and should process any ongoing needs //of the resource manager. For example, the physical manager may attempt to //reconnect lost resources, or a Cloud based manager will stop resources that //have not been used in a set period of time to save money. Will be run //inside the main queue keeper synchronously. Keep() }
The ResourceManager interface is used to implement functionality to manage * resources throughout the queue. All resource actions (add, remove, update) * will need to go through a manager, even for default or physical resources. * This interface is what the queue will expect for all manager operations. * Creation of managers should occur through the setup function, which takes * the path to the configuration file, and gets called when the Queue daemon is * setting everything up. The Setup function should return a ResourceManager * interface below for the Queue to use.
type ResourcePool ¶
func NewResourcePool ¶
func NewResourcePool() ResourcePool
type StateFile ¶
type StateFile struct { Stack []common.Job `json:"stack"` Pool ResourcePool `json:"pool"` }