本文整理匯總了Golang中deaagent/domain.Task類的典型用法代碼示例。如果您正苦於以下問題:Golang Task類的具體用法?Golang Task怎麽用?Golang Task使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Task類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestIdentifier
func TestIdentifier(t *testing.T) {
task := domain.Task{
ApplicationId: "4aa9506e-277f-41ab-b764-a35c0b96fa1b",
WardenJobId: 272,
WardenContainerPath: "/var/vcap/data/warden/depot/16vbs06ibo1"}
assert.Equal(t, "/var/vcap/data/warden/depot/16vbs06ibo1/jobs/272", task.Identifier())
}
示例2: NewTaskListener
func NewTaskListener(task domain.Task, e emitter.Emitter, logger *gosteno.Logger) *TaskListener {
return &TaskListener{
Logger: logger,
emitter: e,
taskIdentifier: task.Identifier(),
stdOutListener: loggingstream.NewLoggingStream(&task, logger, logmessage.LogMessage_OUT),
stdErrListener: loggingstream.NewLoggingStream(&task, logger, logmessage.LogMessage_ERR),
}
}
示例3: setupSockets
func setupSockets(t *testing.T, task *domain.Task) (net.Listener, net.Listener) {
stdoutSocketPath := filepath.Join(task.Identifier(), "stdout.sock")
stderrSocketPath := filepath.Join(task.Identifier(), "stderr.sock")
os.Remove(stdoutSocketPath)
os.Remove(stderrSocketPath)
stdoutListener, err := net.Listen("unix", stdoutSocketPath)
assert.NoError(t, err)
stderrListener, err := net.Listen("unix", stderrSocketPath)
assert.NoError(t, err)
return stdoutListener, stderrListener
}
示例4: NewTaskListener
func NewTaskListener(task domain.Task, logger *gosteno.Logger) (*TaskListener, error) {
stdOutReader, err := dial(task.Identifier(), events.LogMessage_OUT, logger)
if err != nil {
return nil, errors.New(fmt.Sprintf("Connection to stdout %s failed\n", task.Identifier()))
}
stdErrReader, err := dial(task.Identifier(), events.LogMessage_ERR, logger)
if err != nil {
stdOutReader.Close()
return nil, errors.New(fmt.Sprintf("Connection to stderr %s failed\n", task.Identifier()))
}
return &TaskListener{
Logger: logger,
taskIdentifier: task.Identifier(),
stdOutReader: stdOutReader,
stdErrReader: stdErrReader,
task: task,
}, nil
}
示例5: setupTaskSockets
func setupTaskSockets(task *domain.Task) (stdout net.Listener, stderr net.Listener) {
os.MkdirAll(task.Identifier(), 0777)
stdoutSocketPath := filepath.Join(task.Identifier(), "stdout.sock")
os.Remove(stdoutSocketPath)
stdoutListener, _ := net.Listen("unix", stdoutSocketPath)
stderrSocketPath := filepath.Join(task.Identifier(), "stderr.sock")
os.Remove(stderrSocketPath)
stderrListener, _ := net.Listen("unix", stderrSocketPath)
return stdoutListener, stderrListener
}
示例6: setupTaskSockets
func setupTaskSockets(task *domain.Task) (stdout net.Listener, stderr net.Listener) {
err := os.MkdirAll(task.Identifier(), 0777)
Expect(err).NotTo(HaveOccurred())
stdoutSocketPath := filepath.Join(task.Identifier(), "stdout.sock")
_ = os.Remove(stdoutSocketPath)
stdoutListener, err := net.Listen("unix", stdoutSocketPath)
Expect(err).NotTo(HaveOccurred())
stderrSocketPath := filepath.Join(task.Identifier(), "stderr.sock")
_ = os.Remove(stderrSocketPath)
stderrListener, err := net.Listen("unix", stderrSocketPath)
Expect(err).NotTo(HaveOccurred())
return stdoutListener, stderrListener
}
示例7:
package domain_test
import (
"deaagent/domain"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Task", func() {
It("sets identifier correctly", func() {
task := domain.Task{
ApplicationId: "4aa9506e-277f-41ab-b764-a35c0b96fa1b",
WardenJobId: 272,
WardenContainerPath: "/var/vcap/data/warden/depot/16vbs06ibo1"}
Expect(task.Identifier()).To(Equal("/var/vcap/data/warden/depot/16vbs06ibo1/jobs/272"))
})
})