Exemple #1
0
func newCPUCruncher(typ, name string, mgr fwk.App) (fwk.Component, error) {
	var err error

	tsk := &CPUCruncher{
		TaskBase: fwk.NewTask(typ, name, mgr),
		cpuch:    make(chan int64),
		quit:     make(chan struct{}),
		inputs:   make([]string, 0),
		outputs:  make([]string, 0),
		cpus:     make([]int64, 0),
	}

	err = tsk.DeclProp("Inputs", &tsk.inputs)
	if err != nil {
		return nil, err
	}

	err = tsk.DeclProp("Outputs", &tsk.outputs)
	if err != nil {
		return nil, err
	}

	err = tsk.DeclProp("CPU", &tsk.cpus)
	if err != nil {
		return nil, err
	}

	return tsk, err
}
Exemple #2
0
func init() {
	fwk.Register(reflect.TypeOf(task2{}),
		func(typ, name string, mgr fwk.App) (fwk.Component, error) {
			var err error
			tsk := &task2{
				TaskBase: fwk.NewTask(typ, name, mgr),
				input:    "ints1",
				output:   "massaged_ints1",
			}
			tsk.fct = func(f int64) int64 {
				return f * f
			}

			err = tsk.DeclProp("Input", &tsk.input)
			if err != nil {
				return nil, err
			}

			err = tsk.DeclProp("Output", &tsk.output)
			if err != nil {
				return nil, err
			}

			err = tsk.DeclProp("Fct", &tsk.fct)
			if err != nil {
				return nil, err
			}

			return tsk, err
		},
	)
}
Exemple #3
0
func newtesthsvc(typ, name string, mgr fwk.App) (fwk.Component, error) {
	var err error

	tsk := &testhsvc{
		TaskBase: fwk.NewTask(typ, name, mgr),
	}

	return tsk, err
}
Exemple #4
0
func newtesthsvc(typ, name string, mgr fwk.App) (fwk.Component, error) {
	var err error

	tsk := &testhsvc{
		TaskBase: fwk.NewTask(typ, name, mgr),
		stream:   "",
	}

	err = tsk.DeclProp("Stream", &tsk.stream)
	if err != nil {
		return nil, err
	}

	return tsk, err
}
Exemple #5
0
func init() {
	fwk.Register(reflect.TypeOf(task3{}),
		func(typ, name string, mgr fwk.App) (fwk.Component, error) {
			var err error
			tsk := &task3{
				TaskBase: fwk.NewTask(typ, name, mgr),
				parts:    "/fads/test/StableParticles",
			}
			err = tsk.DeclProp("Output", &tsk.parts)
			if err != nil {
				return nil, err
			}

			return tsk, err
		},
	)
}
Exemple #6
0
func init() {
	fwk.Register(reflect.TypeOf(task1{}),
		func(typ, name string, mgr fwk.App) (fwk.Component, error) {
			var err error
			tsk := &task1{
				TaskBase: fwk.NewTask(typ, name, mgr),
				i1prop:   "ints1",
				i2prop:   "ints2",
				i1:       -1,
				i2:       +2,
			}

			err = tsk.DeclProp("Ints1", &tsk.i1prop)
			if err != nil {
				return nil, err
			}

			err = tsk.DeclProp("Ints2", &tsk.i2prop)
			if err != nil {
				return nil, err
			}

			err = tsk.DeclProp("Int1", &tsk.i1)
			if err != nil {
				return nil, err
			}

			err = tsk.DeclProp("Int2", &tsk.i2)
			if err != nil {
				return nil, err
			}

			err = tsk.SetProp("Int1", int64(1))
			if err != nil {
				return nil, err
			}

			return tsk, err
		},
	)
}
Exemple #7
0
func newreducer(typ, name string, mgr fwk.App) (fwk.Component, error) {
	var err error

	tsk := &reducer{
		TaskBase: fwk.NewTask(typ, name, mgr),
		input:    "Input",
		sum:      0,
		exp:      0,
		nevts:    0,
	}

	err = tsk.DeclProp("Input", &tsk.input)
	if err != nil {
		return nil, err
	}

	err = tsk.DeclProp("Sum", &tsk.exp)
	if err != nil {
		return nil, err
	}

	return tsk, err
}