Ejemplo n.º 1
0
func (s *Session) GetApplication() model.Application {
	if s.cache["application"] == nil {
		application_id := bson.ObjectIdHex(s.GetURLParam("application_id"))
		s.cache["application"] = model.FindApplicationById(application_id)
	}

	return s.cache["application"].(model.Application)
}
Ejemplo n.º 2
0
func (job Job) ExecuteWithOutput() map[string]interface{} {
	getJob(job.ApplicationId)

	job.CachePath = config.SharedConfig.JobCachePath
	job.Port = config.SharedConfig.ServerPort

	application_id := bson.ObjectIdHex(job.ApplicationId)
	application := model.FindApplicationById(application_id)
	user := application.GetSuperUser()

	user.NewTriggerSession()

	job.SuperUser = user

	input_bytes, _ := json.Marshal(job)

	process := Process{}
	process.Start(config.SharedConfig.ScriptDirectory + "/runner.js")

	logger.Debug(string(input_bytes))

	process.Write(input_bytes)
	return <-process.ResultChan
}