Documentation ¶
Index ¶
- Constants
- Variables
- func GetSeedPeerClusterConfigBySeedPeer(seedPeer *managerv1.SeedPeer) (types.SeedPeerClusterConfig, error)
- type CertSpec
- type Config
- type DynConfig
- type DynconfigData
- type DynconfigInterface
- type DynconfigOption
- type GCConfig
- type HostConfig
- type JobConfig
- type KeepAliveConfig
- type ManagerConfig
- type MetricsConfig
- type NetworkConfig
- type Observer
- type RedisConfig
- type SchedulerConfig
- type SecurityConfig
- type SeedPeerConfig
- type ServerConfig
- type StorageConfig
- type TrainingConfig
Constants ¶
View Source
const ( // DefaultSeedPeerConcurrentUploadLimit is default number for seed peer concurrent upload limit. DefaultSeedPeerConcurrentUploadLimit = 300 // DefaultPeerConcurrentUploadLimit is default number for peer concurrent upload limit. DefaultPeerConcurrentUploadLimit = 50 // DefaultPeerParallelCount is default number for pieces to download in parallel. DefaultPeerParallelCount = 4 // DefaultSchedulerFilterParentLimit is default limit the number for filter traversals. DefaultSchedulerFilterParentLimit = 4 // DefaultSchedulerFilterParentRangeLimit is default limit the range for filter traversals. DefaultSchedulerFilterParentRangeLimit = 40 )
View Source
const ( // DefaultSchedulerAlgorithm is default algorithm for scheduler. DefaultSchedulerAlgorithm = "default" // DefaultSchedulerBackToSourceCount is default back-to-source count for scheduler. DefaultSchedulerBackToSourceCount = 3 // DefaultSchedulerRetryBackToSourceLimit is default retry back-to-source limit for scheduler. DefaultSchedulerRetryBackToSourceLimit = 5 // DefaultSchedulerRetryLimit is default retry limit for scheduler. DefaultSchedulerRetryLimit = 10 // DefaultSchedulerRetryInterval is default retry interval for scheduler. DefaultSchedulerRetryInterval = 50 * time.Millisecond // DefaultSchedulerPieceDownloadTimeout is default timeout of downloading piece. DefaultSchedulerPieceDownloadTimeout = 30 * time.Minute // DefaultSchedulerPeerGCInterval is default interval for peer gc. DefaultSchedulerPeerGCInterval = 10 * time.Second // DefaultSchedulerPeerTTL is default ttl for peer. DefaultSchedulerPeerTTL = 24 * time.Hour // DefaultSchedulerTaskGCInterval is default interval for task gc. DefaultSchedulerTaskGCInterval = 30 * time.Minute // DefaultSchedulerHostGCInterval is default interval for host gc. DefaultSchedulerHostGCInterval = 1 * time.Hour // DefaultRefreshModelInterval is model refresh interval. DefaultRefreshModelInterval = 168 * time.Hour // DefaultCPU is default cpu usage. DefaultCPU = 1 )
View Source
const ( // DefaultManagerSchedulerClusterID is default id for scheduler cluster. DefaultManagerSchedulerClusterID = 1 // DefaultManagerKeepAliveInterval is default interval for keepalive. DefaultManagerKeepAliveInterval = 5 * time.Second )
View Source
const ( // DefaultJobGlobalWorkerNum is default global worker number for job. DefaultJobGlobalWorkerNum = 500 // DefaultJobSchedulerWorkerNum is default scheduler worker number for job. DefaultJobSchedulerWorkerNum = 500 // DefaultJobGlobalWorkerNum is default local worker number for job. DefaultJobLocalWorkerNum = 1000 // DefaultJobRedisBrokerDB is default db for redis broker. DefaultJobRedisBrokerDB = 1 // DefaultJobRedisBackendDB is default db for redis backend. DefaultJobRedisBackendDB = 2 )
View Source
const ( // DefaultStorageMaxSize is the default maximum size of record file. DefaultStorageMaxSize = 100 // DefaultStorageMaxBackups is the default maximum count of backup. DefaultStorageMaxBackups = 10 // DefaultStorageBufferSize is the default size of buffer container. DefaultStorageBufferSize = 100 )
View Source
const ( // DefaultDynConfigRefreshInterval is default refresh interval for dynamic configuration. DefaultDynConfigRefreshInterval = 10 * time.Second )
View Source
const (
// DefaultMetricsAddr is default address for metrics server.
DefaultMetricsAddr = ":8000"
)
View Source
const (
// DefaultServerPort is default port for server.
DefaultServerPort = 8002
)
Variables ¶
View Source
var ( // DefaultCertValidityPeriod is default validity period of certificate. DefaultCertValidityPeriod = 180 * 24 * time.Hour )
View Source
var ( // DefaultNetworkEnableIPv6 is default value of enableIPv6. DefaultNetworkEnableIPv6 = false )
Functions ¶
func GetSeedPeerClusterConfigBySeedPeer ¶ added in v2.0.9
func GetSeedPeerClusterConfigBySeedPeer(seedPeer *managerv1.SeedPeer) (types.SeedPeerClusterConfig, error)
GetSeedPeerClusterConfigBySeedPeer returns the seed peer cluster config by seed peer.
Types ¶
type Config ¶
type Config struct { // Base options. base.Options `yaml:",inline" mapstructure:",squash"` // Scheduler configuration. Scheduler SchedulerConfig `yaml:"scheduler" mapstructure:"scheduler"` // Server configuration. Server ServerConfig `yaml:"server" mapstructure:"server"` // Dynconfig configuration. DynConfig DynConfig `yaml:"dynConfig" mapstructure:"dynConfig"` // Manager configuration. Manager ManagerConfig `yaml:"manager" mapstructure:"manager"` // SeedPeer configuration. SeedPeer SeedPeerConfig `yaml:"seedPeer" mapstructure:"seedPeer"` // Host configuration. Host HostConfig `yaml:"host" mapstructure:"host"` // Job configuration. Job JobConfig `yaml:"job" mapstructure:"job"` // Storage configuration. Storage StorageConfig `yaml:"storage" mapstructure:"storage"` // Metrics configuration. Metrics MetricsConfig `yaml:"metrics" mapstructure:"metrics"` // Security configuration. Security SecurityConfig `yaml:"security" mapstructure:"security"` // Network configuration. Network NetworkConfig `yaml:"network" mapstructure:"network"` }
type DynconfigData ¶
type DynconfigData struct { Scheduler *managerv1.Scheduler Applications []*managerv1.Application }
type DynconfigInterface ¶
type DynconfigInterface interface { // GetResolveSeedPeerAddrs returns the dynamic schedulers resolve addrs. GetResolveSeedPeerAddrs() ([]resolver.Address, error) // GetScheduler returns the scheduler config from manager. GetScheduler() (*managerv1.Scheduler, error) // GetApplications returns the applications config from manager. GetApplications() ([]*managerv1.Application, error) // GetSeedPeers returns the dynamic seed peers config from manager. GetSeedPeers() ([]*managerv1.SeedPeer, error) // GetSchedulerCluster returns the the scheduler cluster config from manager. GetSchedulerCluster() (*managerv1.SchedulerCluster, error) // GetSchedulerClusterConfig returns the scheduler cluster config. GetSchedulerClusterConfig() (types.SchedulerClusterConfig, error) // GetSchedulerClusterClientConfig returns the client config. GetSchedulerClusterClientConfig() (types.SchedulerClusterClientConfig, error) // Get returns the dynamic config from manager. Get() (*DynconfigData, error) // Refresh refreshes dynconfig in cache. Refresh() error // Register allows an instance to register itself to listen/observe events. Register(Observer) // Deregister allows an instance to remove itself from the collection of observers/listeners. Deregister(Observer) // Notify publishes new events to listeners. Notify() error // Serve the dynconfig listening service. Serve() error // Stop the dynconfig listening service. Stop() error }
func NewDynconfig ¶
func NewDynconfig(rawManagerClient managerclient.Client, cacheDir string, cfg *Config, options ...DynconfigOption) (DynconfigInterface, error)
NewDynconfig returns a new dynconfig instence.
type DynconfigOption ¶ added in v2.0.9
type DynconfigOption func(d *dynconfig) error
DynconfigOption is a functional option for configuring the dynconfig.
func WithTransportCredentials ¶ added in v2.0.9
func WithTransportCredentials(creds credentials.TransportCredentials) DynconfigOption
WithTransportCredentials returns a DialOption which configures a connection level security credentials (e.g., TLS/SSL).
type GCConfig ¶
type GCConfig struct { // PieceDownloadTimeout is timout of downloading piece. PieceDownloadTimeout time.Duration `yaml:"pieceDownloadTimeout" mapstructure:"pieceDownloadTimeout"` // PeerGCInterval is interval of peer gc. PeerGCInterval time.Duration `yaml:"peerGCInterval" mapstructure:"peerGCInterval"` // PeerTTL is time to live of peer. PeerTTL time.Duration `yaml:"peerTTL" mapstructure:"peerTTL"` // TaskGCInterval is interval of task gc. TaskGCInterval time.Duration `yaml:"taskGCInterval" mapstructure:"taskGCInterval"` // HostGCInterval is interval of host gc. HostGCInterval time.Duration `yaml:"hostGCInterval" mapstructure:"hostGCInterval"` }
type HostConfig ¶
type JobConfig ¶
type JobConfig struct { // Enable job service. Enable bool `yaml:"enable" mapstructure:"enable"` // Number of workers in global queue. GlobalWorkerNum uint `yaml:"globalWorkerNum" mapstructure:"globalWorkerNum"` // Number of workers in scheduler queue. SchedulerWorkerNum uint `yaml:"schedulerWorkerNum" mapstructure:"schedulerWorkerNum"` // Number of workers in local queue. LocalWorkerNum uint `yaml:"localWorkerNum" mapstructure:"localWorkerNum"` // Redis configuration. Redis RedisConfig `yaml:"redis" mapstructure:"redis"` }
type KeepAliveConfig ¶
type ManagerConfig ¶
type ManagerConfig struct { // Addr is manager address. Addr string `yaml:"addr" mapstructure:"addr"` // SchedulerClusterID is scheduler cluster id. SchedulerClusterID uint `yaml:"schedulerClusterID" mapstructure:"schedulerClusterID"` // KeepAlive configuration. KeepAlive KeepAliveConfig `yaml:"keepAlive" mapstructure:"keepAlive"` }
type MetricsConfig ¶ added in v2.0.1
type NetworkConfig ¶ added in v2.0.7
type NetworkConfig struct { // EnableIPv6 enables ipv6 for server. EnableIPv6 bool `mapstructure:"enableIPv6" yaml:"enableIPv6"` }
type Observer ¶
type Observer interface { // OnNotify allows an event to be published to interface implementations. OnNotify(*DynconfigData) }
type RedisConfig ¶
type RedisConfig struct { // DEPRECATED: Please use the `addrs` field instead. Host string `yaml:"host" mapstructure:"host"` // DEPRECATED: Please use the `addrs` field instead. Port int `yaml:"port" mapstructure:"port"` // Addrs is server addresses. Addrs []string `yaml:"addrs" mapstructure:"addrs"` // MasterName is the sentinel master name. MasterName string `yaml:"masterName" mapstructure:"masterName"` // Username is server username. Username string `yaml:"username" mapstructure:"username"` // Password is server password. Password string `yaml:"password" mapstructure:"password"` // BrokerDB is broker database name. BrokerDB int `yaml:"brokerDB" mapstructure:"brokerDB"` // BackendDB is backend database name. BackendDB int `yaml:"backendDB" mapstructure:"backendDB"` }
type SchedulerConfig ¶
type SchedulerConfig struct { // Algorithm is scheduling algorithm used by the scheduler. Algorithm string `yaml:"algorithm" mapstructure:"algorithm"` // DEPRECATED: Please use the `backToSourceCount` field instead. BackSourceCount int `yaml:"backSourceCount" mapstructure:"backSourceCount"` // DEPRECATED: Please use the `retryBackToSourceLimit` field instead. RetryBackSourceLimit int `yaml:"retryBackSourceLimit" mapstructure:"retryBackSourceLimit"` // BackToSourceCount is single task allows the peer to back-to-source count. BackToSourceCount int `yaml:"backToSourceCount" mapstructure:"backToSourceCount"` // RetryBackToSourceLimit reaches the limit, then the peer back-to-source. RetryBackToSourceLimit int `yaml:"retryBackToSourceLimit" mapstructure:"retryBackToSourceLimit"` // RetryLimit reaches the limit, then scheduler returns scheduling failed. RetryLimit int `yaml:"retryLimit" mapstructure:"retryLimit"` // RetryInterval is scheduling interval. RetryInterval time.Duration `yaml:"retryInterval" mapstructure:"retryInterval"` // GC configuration. GC GCConfig `yaml:"gc" mapstructure:"gc"` // Training configuration. Training TrainingConfig `yaml:"training" mapstructure:"training"` }
type SecurityConfig ¶ added in v2.0.6
type SecurityConfig struct { // AutoIssueCert indicates to issue client certificates for all grpc call // if AutoIssueCert is false, any other option in Security will be ignored. AutoIssueCert bool `mapstructure:"autoIssueCert" yaml:"autoIssueCert"` // CACert is the root CA certificate for all grpc tls handshake, it can be path or PEM format string. CACert types.PEMContent `mapstructure:"caCert" yaml:"caCert"` // TLSVerify indicates to verify client certificates. TLSVerify bool `mapstructure:"tlsVerify" yaml:"tlsVerify"` // TLSPolicy controls the grpc shandshake behaviors: // force: both ClientHandshake and ServerHandshake are only support tls. // prefer: ServerHandshake supports tls and insecure (non-tls), ClientHandshake will only support tls. // default: ServerHandshake supports tls and insecure (non-tls), ClientHandshake will only support insecure (non-tls). TLSPolicy string `mapstructure:"tlsPolicy" yaml:"tlsPolicy"` // CertSpec is the desired state of certificate. CertSpec CertSpec `mapstructure:"certSpec" yaml:"certSpec"` }
type SeedPeerConfig ¶ added in v2.0.3
type SeedPeerConfig struct { // Enable is to enable seed peer as P2P peer. Enable bool `yaml:"enable" mapstructure:"enable"` }
type ServerConfig ¶
type ServerConfig struct { // DEPRECATED: Please use the `advertiseIP` field instead. IP string `yaml:"ip" mapstructure:"ip"` // DEPRECATED: Please use the `listenIP` field instead. Listen string `yaml:"listen" mapstructure:"listen"` // AdvertiseIP is advertise ip. AdvertiseIP string `yaml:"advertiseIP" mapstructure:"advertiseIP"` // ListenIP is listen ip, like: 0.0.0.0, 192.168.0.1. ListenIP string `yaml:"listenIP" mapstructure:"listenIP"` // Server port. Port int `yaml:"port" mapstructure:"port"` // Server hostname. Host string `yaml:"host" mapstructure:"host"` // Server work directory. WorkHome string `yaml:"workHome" mapstructure:"workHome"` // Server dynamic config cache directory. CacheDir string `yaml:"cacheDir" mapstructure:"cacheDir"` // Server log directory. LogDir string `yaml:"logDir" mapstructure:"logDir"` // Server plugin directory. PluginDir string `yaml:"pluginDir" mapstructure:"pluginDir"` // Server storage data directory. DataDir string `yaml:"dataDir" mapstructure:"dataDir"` }
type StorageConfig ¶ added in v2.0.3
type StorageConfig struct { // MaxSize sets the maximum size in megabytes of storage file. MaxSize int `yaml:"maxSize" mapstructure:"maxSize"` // MaxBackups sets the maximum number of storage files to retain. MaxBackups int `yaml:"maxBackups" mapstructure:"maxBackups"` // BufferSize sets the size of buffer container, // if the buffer is full, write all the records in the buffer to the file. BufferSize int `yaml:"bufferSize" mapstructure:"bufferSize"` }
type TrainingConfig ¶ added in v2.0.5
type TrainingConfig struct { // Enable training. Enable bool `yaml:"enable" mapstructure:"enable"` // Enable auto refresh model. EnableAutoRefresh bool `yaml:"enableAutoRefresh" mapstructure:"enableAutoRefresh"` // RefreshModelInterval is refresh interval for refreshing model. RefreshModelInterval time.Duration `yaml:"refreshModelInterval" mapstructure:"refreshModelInterval"` // CPU limit while training. CPU int `yaml:"cpu" mapstructure:"cpu"` }
Click to show internal directories.
Click to hide internal directories.