Example #1
0
File: main.go Project: postfix/fwk
func main() {
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, `Usage: %[1]s [options] <input-file> <output-file>

ex:
 $ %[1]s -l=INFO -evtmax=-1 ./input.ascii ./output.ascii

options:
`,
			os.Args[0],
		)
		flag.PrintDefaults()
	}

	flag.Parse()

	start := time.Now()
	fmt.Printf("::: %s...\n", os.Args[0])

	// create a default fwk application, with some properties
	// extracted from the CLI
	app := job.NewJob(nil, job.P{
		"EvtMax":   *evtmax,
		"NProcs":   *nprocs,
		"MsgLevel": job.MsgLevel(*lvl),
	})

	app.Create(job.C{
		Type: "main.testhsvc",
		Name: "t-01",
		Props: job.P{
			"Stream": "/my-hist",
		},
	})

	app.Create(job.C{
		Type: "main.testhsvc",
		Name: "t-02",
		Props: job.P{
			"Stream": "/my-hist",
		},
	})

	app.Create(job.C{
		Type: "github.com/go-hep/fwk/hbooksvc.hsvc",
		Name: "histsvc",
		Props: job.P{
			"Streams": map[string]hbooksvc.Stream{
				"/my-hist": {
					Name: "hist.rio",
					Mode: hbooksvc.Read,
				},
			},
		},
	})

	app.Run()
	fmt.Printf("::: %s... [done] (cpu=%v)\n", os.Args[0], time.Since(start))
}
Example #2
0
func newapp(evtmax int64, nprocs int) *job.Job {
	app := job.NewJob(nil, job.P{
		"EvtMax":   evtmax,
		"NProcs":   nprocs,
		"MsgLevel": job.MsgLevel("ERROR"),
	})
	return app
}