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


Golang JobServer.AddWorkUnits方法代码示例

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


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

示例1: addWorkUnit

// addWorkUnit packages a single work unit key and data dictionary
// into the tuple format JobServer expects, and calls AddWorkUnits(),
// checking the result.
func addWorkUnit(t *testing.T, j *jobserver.JobServer, workSpecName, key string, data map[string]interface{}) {
	keyDataPair := cborrpc.PythonTuple{Items: []interface{}{key, data}}
	keyDataList := []interface{}{keyDataPair}
	ok, msg, err := j.AddWorkUnits(workSpecName, keyDataList)
	if assert.NoError(t, err) {
		assert.True(t, ok)
		assert.Empty(t, msg)
	}
}
开发者ID:diffeo,项目名称:go-coordinate,代码行数:12,代码来源:python_test.go

示例2: addPrefixedWorkUnits

// addPrefixedWorkUnits adds a series of similarly-named work units
// to a work spec.  If prefix is "u", it adds count work units named
// u001, u002, ....  The work spec dictionaries have a single key "k"
// with values v1, v2, ....
func addPrefixedWorkUnits(t *testing.T, j *jobserver.JobServer, workSpecName, prefix string, count int) {
	workUnitKvps := make([]interface{}, count)
	for i := range workUnitKvps {
		key := fmt.Sprintf("%s%03d", prefix, i+1)
		data := map[string]interface{}{"k": fmt.Sprintf("v%v", i+1)}
		items := []interface{}{key, data}
		workUnitKvps[i] = cborrpc.PythonTuple{Items: items}
	}
	ok, msg, err := j.AddWorkUnits(workSpecName, workUnitKvps)
	if assert.NoError(t, err) {
		assert.True(t, ok)
		assert.Empty(t, msg)
	}
}
开发者ID:diffeo,项目名称:go-coordinate,代码行数:18,代码来源:python_test.go

示例3: addWorkUnits

// addWorkUnits adds a batch of work units to the system in one call.
func addWorkUnits(t *testing.T, j *jobserver.JobServer, workSpecName string, workUnits map[string]map[string]interface{}) {
	// Assemble the parameters to AddWorkUnits as one big list of
	// pairs of (key, data)
	var awu []interface{}
	for name, data := range workUnits {
		pair := []interface{}{name, data}
		awu = append(awu, pair)
	}
	ok, msg, err := j.AddWorkUnits(workSpecName, awu)
	if assert.NoError(t, err) {
		assert.True(t, ok)
		assert.Empty(t, msg)
	}
}
开发者ID:diffeo,项目名称:go-coordinate,代码行数:15,代码来源:python_test.go


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