Documentation
¶
Index ¶
- Constants
- Variables
- type Agent
- func (a *Agent) AddJob(in *pb.Job) (out *pb.Job, err error)
- func (a *Agent) DeleteJob(in *pb.Job) (out *pb.Job, err error)
- func (a *Agent) GetJob(name, region string) (*pb.Job, error)
- func (a *Agent) GetStatus(name, region string) (out *pb.JobStatus, err error)
- func (a *Agent) ListExecutions(in *pb.Execution, search *pb.Search) (out []*pb.Execution, count int32, err error)
- func (a *Agent) ListJob(in *pb.Job, search *pb.Search) (jobs []*pb.Job, count int32, err error)
- func (a *Agent) ListNode(node *pb.Node, search *pb.Search) (nodes []*pb.Node, count int32, err error)
- func (a *Agent) ListRegions() (regions []string, err error)
- func (a *Agent) ModifyJob(in *pb.Job) (out *pb.Job, err error)
- func (a *Agent) PerformOps(obj interface{}, ops pb.Ops, search *pb.Search) ([]interface{}, int32, error)
- func (a *Agent) Reload(args []string)
- func (a *Agent) RemovePid() error
- func (a *Agent) Run() error
- func (a *Agent) RunJob(name, region string) (*pb.Execution, error)
- func (a *Agent) Search(in interface{}, search *pb.Search) (out []interface{}, count int32, err error)
- func (a *Agent) SendBackExecution(ex *pb.Execution) (err error)
- func (a *Agent) Stop(graceful bool) int
- func (a *Agent) WritePid() error
- type Config
Constants ¶
View Source
const ( DefaultRegion = "MARS" DefaultSerfPort = 8998 DefaultHttpPort = 8088 DefaultRPCPort = 7979 DefaultSnapshotPath = "./snapshot" DefaultConfigFile = "./conf/djob.yml" DefaultPidFile = "./djob.pid" DefaultKeySpeace = "djob" DefaultSQLPort = 3306 DefaultSQLHost = "localhost" DefaultSQLUser = "djob" DefaultDBName = "djob" )
default values
View Source
const ( LOADNOTHING loadJobPolicy = 1 + iota // load nothing LOADOWN // load all the jobs belong to this server LOADALL // load all unassigned jobs )
load job policy
View Source
const ( QueryRunJob = "job:run" QueryJobCount = "job:count" )
string of serf query mark
View Source
const ( // APITimeOut max api execution time APITimeOut = 1 * time.Second )
Variables ¶
View Source
var RESERVEDTAGS = [...]string{"RPCADIP", "RPCADPORT", "NODE", "REGION", "SERVER", "VERSION"}
RESERVEDTAGS store protected tag that is not allowed to be modified
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent djob agent struct
func (*Agent) ListExecutions ¶
func (a *Agent) ListExecutions(in *pb.Execution, search *pb.Search) (out []*pb.Execution, count int32, err error)
ListExecutions get job executions
func (*Agent) ListNode ¶
func (a *Agent) ListNode(node *pb.Node, search *pb.Search) (nodes []*pb.Node, count int32, err error)
ListNode get node info, support paging TODO: Need more elegant realization
func (*Agent) ListRegions ¶
ListRegions list all available regions search in memory cache first, if no cache, set it with 120s ttl
func (*Agent) PerformOps ¶
func (a *Agent) PerformOps(obj interface{}, ops pb.Ops, search *pb.Search) ([]interface{}, int32, error)
PerformOps func forwarding ops to remote or perform it in local
func (*Agent) Search ¶
func (a *Agent) Search(in interface{}, search *pb.Search) (out []interface{}, count int32, err error)
Search job or execution TODO: use concurrency instead of recursion
func (*Agent) SendBackExecution ¶
SendBackExecution handle job exec return
type Config ¶
type Config struct {
Server bool // start as server or just agent
LoadJobPolicy loadJobPolicy // the policy for loading jobs from the database at server startup
Region string // agent region
Nodename string //serf node name
Tags map[string]string // agent tags used to filter agent
SerfBindIP string // serf system bind address ip
SerfBindPort int
SerfAdvertiseIP string // serf system advertise address ip used for agent behind a firewall
SerfAdvertisePort int
SerfJoin []string
APIBindIP string // HTTP API PORT just effect when server is true
APIBindPort int
JobStore string // key value storage type etd/zookeeper etc.
JobStoreServers []string // k/v storage server list [ip:port]
JobStoreKeyspace string // keyspace in the storage
LogLevel string // info debug error
LogFile string // log file path
RPCTls bool // grpc enable tls or not
CAFile string // tls ca file used in agent
KeyFile string // key file used in server
CertFile string // cert file used in server
RPCBindIP string // grcp bind addr ip
RPCBindPort int
RPCAdcertiseIP string // sames to serf advertise addr
RPCAdcertisePort int
SerfSnapshotPath string //serf use this path to save snapshot of joined server
DSN string
APITokens map[string]string
PidFile string // pid file path
// contains filtered or unexported fields
}
Config struct store agent config
func ReadConfig ¶
ReadConfig func read the configuration file
func (*Config) EncryptKey ¶
EncryptKey func base64 encode encrypt key
Click to show internal directories.
Click to hide internal directories.