本文整理汇总了Python中celery.result.ResultSet.get方法的典型用法代码示例。如果您正苦于以下问题:Python ResultSet.get方法的具体用法?Python ResultSet.get怎么用?Python ResultSet.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.result.ResultSet
的用法示例。
在下文中一共展示了ResultSet.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_result_set_error
# 需要导入模块: from celery.result import ResultSet [as 别名]
# 或者: from celery.result.ResultSet import get [as 别名]
def test_result_set_error(self, manager):
assert manager.inspect().ping()
rs = ResultSet([raise_error.delay(), add.delay(1, 1)])
rs.get(timeout=TIMEOUT, propagate=False)
assert rs.results[0].failed()
assert rs.results[1].successful()
示例2: test_get
# 需要导入模块: from celery.result import ResultSet [as 别名]
# 或者: from celery.result.ResultSet import get [as 别名]
def test_get(self):
x = ResultSet(map(AsyncResult, [1, 2, 3]))
b = x.results[0].backend = Mock()
b.supports_native_join = False
x.join_native = Mock()
x.join = Mock()
x.get()
self.assertTrue(x.join.called)
b.supports_native_join = True
x.get()
self.assertTrue(x.join_native.called)
示例3: test_result_set
# 需要导入模块: from celery.result import ResultSet [as 别名]
# 或者: from celery.result.ResultSet import get [as 别名]
def test_result_set(self, manager):
assert manager.inspect().ping()
rs = ResultSet([add.delay(1, 1), add.delay(2, 2)])
assert rs.get(timeout=TIMEOUT) == [2, 4]
示例4: get_check_prime
# 需要导入模块: from celery.result import ResultSet [as 别名]
# 或者: from celery.result.ResultSet import get [as 别名]
def get_check_prime(minimum, maximum):
data = range(int(minimum), int(maximum))
chunks = [data[x:x+CHUNK_SIZE] for x in xrange(0, len(data), CHUNK_SIZE)]
results = ResultSet(map(is_prime, chunks))
result = sum(results.get(), [])
return json.dumps([x[0] for x in result if x[1]])