Exemple #1
0
func loadContext() error {
	f, err := os.Open(*configPath)
	if err != nil {
		return err
	}
	defer f.Close()

	ctx, err := common.NewContextFromReader(f)
	if err != nil {
		return err
	}
	globalContext.Store(ctx)
	return nil
}
Exemple #2
0
func NewContext(reader io.Reader) (*Context, error) {
	ctx, err := common.NewContextFromReader(reader)
	if err != nil {
		return nil, err
	}
	var context = &Context{
		Context:         *ctx,
		QueueManager:    NewQueueManager(ctx.Config.Grader.ChannelLength),
		InflightMonitor: NewInflightMonitor(),
		InputManager:    common.NewInputManager(ctx),
	}

	return context, nil
}