• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang build.Build类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/evergreen-ci/evergreen/model/build.Build的典型用法代码示例。如果您正苦于以下问题:Golang Build类的具体用法?Golang Build怎么用?Golang Build使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Build类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: updateMakespans

// updateMakespans
func updateMakespans(b *build.Build) error {
	// find all tasks associated with the build
	tasks, err := task.Find(task.ByBuildId(b.Id))
	if err != nil {
		return err
	}

	depPath := FindPredictedMakespan(tasks)
	return b.UpdateMakespans(depPath.TotalTime, CalculateActualMakespan(tasks))
}
开发者ID:tychoish,项目名称:evergreen,代码行数:11,代码来源:task_lifecycle.go


示例2: AddTasksToBuild

//AddTasksToBuild creates the tasks for the given build of a project
func AddTasksToBuild(b *build.Build, project *Project, v *version.Version,
	taskNames []string) (*build.Build, error) {

	// find the build variant for this project/build
	buildVariant := project.FindBuildVariant(b.BuildVariant)
	if buildVariant == nil {
		return nil, fmt.Errorf("Could not find build %v in %v project file",
			b.BuildVariant, project.Identifier)
	}

	// create the new tasks for the build
	tasks, err := createTasksForBuild(
		project, buildVariant, b, v, BuildTaskIdTable(project, v), taskNames)
	if err != nil {
		return nil, fmt.Errorf("error creating tasks for build %v: %v",
			b.Id, err)
	}

	// insert the tasks into the db
	for _, task := range tasks {
		evergreen.Logger.Logf(slogger.INFO, "Creating task “%v”", task.DisplayName)
		if err := task.Insert(); err != nil {
			return nil, fmt.Errorf("error inserting task %v: %v", task.Id, err)
		}
	}

	// create task caches for all of the tasks, and add them into the build
	for _, t := range tasks {
		b.Tasks = append(b.Tasks, cacheFromTask(t))
	}

	// update the build to hold the new tasks
	if err = build.SetTasksCache(b.Id, b.Tasks); err != nil {
		return nil, err
	}

	return b, nil
}
开发者ID:tessavitabile,项目名称:evergreen,代码行数:39,代码来源:lifecycle.go


示例3: TestMarkAsDispatched

func TestMarkAsDispatched(t *testing.T) {

	var (
		taskId  string
		hostId  string
		buildId string
		task    *Task
		myHost  *host.Host
		b       *build.Build
	)

	Convey("With a task", t, func() {

		taskId = "t1"
		hostId = "h1"
		buildId = "b1"

		task = &Task{
			Id:      taskId,
			BuildId: buildId,
		}

		myHost = &host.Host{
			Id: hostId,
		}

		b = &build.Build{
			Id: buildId,
			Tasks: []build.TaskCache{
				{Id: taskId},
			},
		}

		testutil.HandleTestingErr(
			db.ClearCollections(TasksCollection, build.Collection, host.Collection),
			t, "Error clearing test collections")

		So(task.Insert(), ShouldBeNil)
		So(myHost.Insert(), ShouldBeNil)
		So(b.Insert(), ShouldBeNil)

		Convey("when marking the task as dispatched, the fields for"+
			" the task, the host it is on, and the build it is a part of"+
			" should be set to reflect this", func() {

			// mark the task as dispatched
			So(task.MarkAsDispatched(myHost, time.Now()), ShouldBeNil)

			// make sure the task's fields were updated, both in memory and
			// in the db
			So(task.DispatchTime, ShouldNotResemble, time.Unix(0, 0))
			So(task.Status, ShouldEqual, evergreen.TaskDispatched)
			So(task.HostId, ShouldEqual, myHost.Id)
			So(task.LastHeartbeat, ShouldResemble, task.DispatchTime)
			task, err := FindTask(taskId)
			So(err, ShouldBeNil)
			So(task.DispatchTime, ShouldNotResemble, time.Unix(0, 0))
			So(task.Status, ShouldEqual, evergreen.TaskDispatched)
			So(task.HostId, ShouldEqual, myHost.Id)
			So(task.LastHeartbeat, ShouldResemble, task.DispatchTime)

			// make sure the build's fields were updated in the db
			b, err = build.FindOne(build.ById(buildId))
			So(err, ShouldBeNil)
			So(b.Tasks[0].Status, ShouldEqual, evergreen.TaskDispatched)

		})

	})

}
开发者ID:bjori,项目名称:evergreen,代码行数:71,代码来源:task_test.go



注:本文中的github.com/evergreen-ci/evergreen/model/build.Build类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang distro.Find函数代码示例发布时间:2022-05-23
下一篇:
Golang build.UpdateActivation函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap