當前位置: 首頁>>代碼示例>>Golang>>正文


Golang domain.Task類代碼示例

本文整理匯總了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())
}
開發者ID:robsonmwoc,項目名稱:loggregator,代碼行數:8,代碼來源:task_test.go

示例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),
	}
}
開發者ID:robsonmwoc,項目名稱:loggregator,代碼行數:9,代碼來源:task_listener.go

示例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
}
開發者ID:robsonmwoc,項目名稱:loggregator,代碼行數:11,代碼來源:task_listener_test.go

示例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
}
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:18,代碼來源:task_listener.go

示例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
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:11,代碼來源:dea_agent_test.go

示例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
}
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:16,代碼來源:dea_agent_test.go

示例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"))
	})
})
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:18,代碼來源:task_test.go


注:本文中的deaagent/domain.Task類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。