本文整理汇总了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)
}
}
示例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
}