当前位置: 首页>>代码示例>>Golang>>正文


Golang JobServer.UpdateWorkUnit方法代码示例

本文整理汇总了Golang中github.com/diffeo/go-coordinate/jobserver.JobServer.UpdateWorkUnit方法的典型用法代码示例。如果您正苦于以下问题:Golang JobServer.UpdateWorkUnit方法的具体用法?Golang JobServer.UpdateWorkUnit怎么用?Golang JobServer.UpdateWorkUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/diffeo/go-coordinate/jobserver.JobServer的用法示例。


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

示例1: finishWorkUnit

// finishWorkUnit marks a specific work unit as finished.
func finishWorkUnit(t *testing.T, j *jobserver.JobServer, workSpecName, workUnitKey string, data map[string]interface{}) {
	options := map[string]interface{}{
		"status": jobserver.Finished,
	}
	if data != nil {
		options["data"] = data
	}
	ok, msg, err := j.UpdateWorkUnit(workSpecName, workUnitKey, options)
	if assert.NoError(t, err) {
		assert.True(t, ok)
		assert.Empty(t, msg)
	}
}
开发者ID:diffeo,项目名称:go-coordinate,代码行数:14,代码来源:python_test.go

示例2: prepareSomeOfEach

func prepareSomeOfEach(t *testing.T, j *jobserver.JobServer, n int) (workSpecName string, expected map[string]map[string]interface{}) {
	data := map[string]interface{}{"x": 1}
	expected = map[string]map[string]interface{}{}
	workSpecName = setWorkSpec(t, j, WorkSpecData)

	for _, name := range []string{"FA", "IL"}[:n] {
		addWorkUnit(t, j, workSpecName, name, data)
		getSpecificWork(t, j, workSpecName, name)
		ok, msg, err := j.UpdateWorkUnit(workSpecName, name, map[string]interface{}{"status": jobserver.Failed})
		if assert.NoError(t, err) {
			assert.True(t, ok)
			assert.Empty(t, msg)
		}
		expected[name] = data
	}

	for _, name := range []string{"FI", "NI"}[:n] {
		addWorkUnit(t, j, workSpecName, name, data)
		getSpecificWork(t, j, workSpecName, name)
		finishWorkUnit(t, j, workSpecName, name, nil)
		expected[name] = data
	}

	for _, name := range []string{"PE", "ND"}[:n] {
		addWorkUnit(t, j, workSpecName, name, data)
		getSpecificWork(t, j, workSpecName, name)
		expected[name] = data
	}

	for _, name := range []string{"AV", "AI"}[:n] {
		addWorkUnit(t, j, workSpecName, name, data)
		expected[name] = data
	}

	return
}
开发者ID:diffeo,项目名称:go-coordinate,代码行数:36,代码来源:python_test.go


注:本文中的github.com/diffeo/go-coordinate/jobserver.JobServer.UpdateWorkUnit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。