本文整理汇总了Python中bamboo.models.calculation.Calculation.find_one方法的典型用法代码示例。如果您正苦于以下问题:Python Calculation.find_one方法的具体用法?Python Calculation.find_one怎么用?Python Calculation.find_one使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bamboo.models.calculation.Calculation
的用法示例。
在下文中一共展示了Calculation.find_one方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_disallow_delete_dependent_calculation
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def test_disallow_delete_dependent_calculation(self):
record = self._save_observations_and_calculation()
self.name = 'test1'
record = self._save_calculation('test')
calculation = Calculation.find_one(self.dataset.dataset_id, 'test')
self.assertEqual(calculation.dependent_calculations, ['test1'])
calculation = Calculation.find_one(self.dataset.dataset_id, 'test')
assert_raises(DependencyError, calculation.delete, self.dataset)
示例2: test_removes_dependent_calculations
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def test_removes_dependent_calculations(self):
record = self._save_observations_and_calculation()
self.name = 'test1'
record = self._save_calculation('test')
calculation = Calculation.find_one(self.dataset.dataset_id, 'test')
self.assertEqual(calculation.dependent_calculations, ['test1'])
calculation = Calculation.find_one(self.dataset.dataset_id, 'test1')
calculation.delete(self.dataset)
calculation = Calculation.find_one(self.dataset.dataset_id, 'test')
self.assertEqual(calculation.dependent_calculations, [])
示例3: action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def action(dataset):
calculation = Calculation.find_one(dataset.dataset_id, name, group)
if calculation:
calculation.delete(dataset)
message = 'deleted calculation: \'%s\' for dataset: %s' % (
name, dataset.dataset_id)
return {self.SUCCESS: message}
示例4: action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def action(dataset):
calculation = Calculation.find_one(dataset.dataset_id, name, group)
if calculation:
calculation.delete(dataset)
return self._success('deleted calculation: \'%s\'' % name,
dataset_id)
示例5: action
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def action(dataset):
calculation = Calculation.find_one(dataset.dataset_id, name, group)
if calculation:
calculation.delete(dataset)
return {self.SUCCESS: 'deleted calculation: \'%s\'' % name,
Dataset.ID: dataset.dataset_id}
示例6: __wait_for_calculation_ready
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def __wait_for_calculation_ready(self, dataset_id, name):
while True:
calculation = Calculation.find_one(dataset_id, name)
if calculation.is_ready:
break
sleep(self.SLEEP_DELAY)
示例7: test_fail_then_create
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def test_fail_then_create(self):
response = json.loads(self.__post_formula())
self.__verify_create(response)
# Overwrite as failed
calc = Calculation.find_one(self.dataset_id, self.name)
calc.update({calc.STATE: calc.STATE_FAILED})
# Test we can still add a calculation
self.name = 'test2'
response = json.loads(self.__post_formula())
self.__verify_create(response)
示例8: test_fail_in_background
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def test_fail_in_background(self):
dataset_id = self._post_file('wp_data.csv')
group = 'wp_id'
self._wait_for_dataset_state(dataset_id)
self.controller.create(dataset_id,
'newest(submit_date,functional)',
'wp_functional',
group=group)
self.controller.create(dataset_id,
'max(submit_date)',
'latest_submit_date',
group=group)
# Update the name to cause has pending to be true and infinite retries.
# It will fail after 10 retries.
calc = Calculation.find_one(dataset_id, 'latest_submit_date', group)
calc.update({calc.NAME: 'another_name'})
update = {
'wp_id': 'D',
'functional': 'yes',
}
self.__post_update(dataset_id, update)
update = {
'submit_date': '2013-01-08',
'wp_id': 'A',
'functional': 'no',
}
self.__post_update(dataset_id, update)
while True:
dataset = Dataset.find_one(dataset_id)
calcs_not_pending = [
c.state != c.STATE_PENDING for c in dataset.calculations()]
if not len(dataset.pending_updates) and all(calcs_not_pending):
break
sleep(self.SLEEP_DELAY)
for c in dataset.calculations():
self.assertEqual(c.STATE_FAILED, c.state)
self.assertTrue('Traceback' in c.error_message)
示例9: test_sets_dependent_calculations
# 需要导入模块: from bamboo.models.calculation import Calculation [as 别名]
# 或者: from bamboo.models.calculation.Calculation import find_one [as 别名]
def test_sets_dependent_calculations(self):
self._save_observations_and_calculation()
self.name = 'test1'
self._save_calculation('test')
calculation = Calculation.find_one(self.dataset.dataset_id, 'test')
self.assertEqual(calculation.dependent_calculations, ['test1'])