- stderrBufToFlush bytes.Buffer
- stderrFlushedAt time.Time
-
- // rate limiting config parameters
- crunchLimitLogBytesPerJob int64
- crunchLogThrottleBytes int64
- crunchLogThrottlePeriod int
- crunchLogThrottleLines int64
- crunchLogPartialLineThrottlePeriod int
- crunchLogBytesPerEvent int64
- crunchLogSecondsBetweenEvents int
-}
-
-// NewArvLogWriter creates new ArvLogWriter and loads the rate limiting config params
-func NewArvLogWriter(clnt IArvadosClient, uuid string, ls string, wc io.WriteCloser) *ArvLogWriter {
- w := &ArvLogWriter{ArvClient: clnt, UUID: uuid, loggingStream: ls, writeCloser: wc}
-
- // load the rate limit discovery config paramters
- param, err := clnt.Discovery("crunchLimitLogBytesPerJob")
- if err != nil {
- w.crunchLimitLogBytesPerJob = 67108864
- } else {
- w.crunchLimitLogBytesPerJob = int64(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogThrottleBytes")
- if err != nil {
- w.crunchLogThrottleBytes = 65536
- } else {
- w.crunchLogThrottleBytes = int64(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogThrottlePeriod")
- if err != nil {
- w.crunchLogThrottlePeriod = 60
- } else {
- w.crunchLogThrottlePeriod = int(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogThrottleLines")
- if err != nil {
- w.crunchLogThrottleLines = 1024
- } else {
- w.crunchLogThrottleLines = int64(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogPartialLineThrottlePeriod")
- if err != nil {
- w.crunchLogPartialLineThrottlePeriod = 5
- } else {
- w.crunchLogPartialLineThrottlePeriod = int(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogBytesPerEvent")
- if err != nil {
- w.crunchLogBytesPerEvent = 4096
- } else {
- w.crunchLogBytesPerEvent = int64(param.(float64))
- }
-
- param, err = clnt.Discovery("crunchLogSecondsBetweenEvents")
- if err != nil {
- w.crunchLogSecondsBetweenEvents = 1
- } else {
- w.crunchLogSecondsBetweenEvents = int(param.(float64))
- }
-
- return w