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


Python SubtaskStatus.create方法代码示例

本文整理汇总了Python中instructor_task.subtasks.SubtaskStatus.create方法的典型用法代码示例。如果您正苦于以下问题:Python SubtaskStatus.create方法的具体用法?Python SubtaskStatus.create怎么用?Python SubtaskStatus.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在instructor_task.subtasks.SubtaskStatus的用法示例。


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

示例1: test_send_email_completed_subtask

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_completed_subtask(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=no-member
     subtask_id = "subtask-id-value"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     subtask_status = SubtaskStatus.create(subtask_id, state=SUCCESS)
     update_subtask_status(entry_id, subtask_id, subtask_status)
     bogus_email_id = 1001
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     new_subtask_status = SubtaskStatus.create(subtask_id)
     with self.assertRaisesRegexp(DuplicateTaskException, 'already completed'):
         send_course_email(entry_id, bogus_email_id, to_list, global_email_context, new_subtask_status.to_dict())
开发者ID:TabEd,项目名称:edx-platform,代码行数:16,代码来源:test_err_handling.py

示例2: test_send_email_retried_subtask

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_retried_subtask(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=E1101
     subtask_id = "subtask-id-value"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     subtask_status = SubtaskStatus.create(subtask_id, state=RETRY, retried_nomax=2)
     update_subtask_status(entry_id, subtask_id, subtask_status)
     bogus_email_id = 1001
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     # try running with a clean subtask:
     new_subtask_status = SubtaskStatus.create(subtask_id)
     with self.assertRaisesRegexp(DuplicateTaskException, 'already retried'):
         send_course_email(entry_id, bogus_email_id, to_list, global_email_context, new_subtask_status.to_dict())
     # try again, with a retried subtask with lower count:
     new_subtask_status = SubtaskStatus.create(subtask_id, state=RETRY, retried_nomax=1)
     with self.assertRaisesRegexp(DuplicateTaskException, 'already retried'):
         send_course_email(entry_id, bogus_email_id, to_list, global_email_context, new_subtask_status.to_dict())
开发者ID:6thfdwp,项目名称:edx-platform,代码行数:21,代码来源:test_err_handling.py

示例3: test_send_email_undefined_subtask

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_undefined_subtask(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=no-member
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     subtask_id = "subtask-id-value"
     subtask_status = SubtaskStatus.create(subtask_id)
     email_id = 1001
     with self.assertRaisesRegexp(DuplicateTaskException, 'unable to find subtasks of instructor task'):
         send_course_email(entry_id, email_id, to_list, global_email_context, subtask_status.to_dict())
开发者ID:TabEd,项目名称:edx-platform,代码行数:13,代码来源:test_err_handling.py

示例4: test_send_email_missing_subtask

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_missing_subtask(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=no-member
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     subtask_id = "subtask-id-value"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     different_subtask_id = "bogus-subtask-id-value"
     subtask_status = SubtaskStatus.create(different_subtask_id)
     bogus_email_id = 1001
     with self.assertRaisesRegexp(DuplicateTaskException, 'unable to find status for subtask of instructor task'):
         send_course_email(entry_id, bogus_email_id, to_list, global_email_context, subtask_status.to_dict())
开发者ID:TabEd,项目名称:edx-platform,代码行数:15,代码来源:test_err_handling.py

示例5: test_send_email_running_subtask

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_running_subtask(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=E1101
     subtask_id = "subtask-id-value"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     subtask_status = SubtaskStatus.create(subtask_id)
     update_subtask_status(entry_id, subtask_id, subtask_status)
     check_subtask_is_valid(entry_id, subtask_id, subtask_status)
     bogus_email_id = 1001
     to_list = ["[email protected]"]
     global_email_context = {"course_title": "dummy course"}
     with self.assertRaisesRegexp(DuplicateTaskException, "already being executed"):
         send_course_email(entry_id, bogus_email_id, to_list, global_email_context, subtask_status.to_dict())
开发者ID:nanolearning,项目名称:edx-platform,代码行数:16,代码来源:test_err_handling.py

示例6: test_send_email_undefined_email

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_undefined_email(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=no-member
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     subtask_id = "subtask-id-undefined-email"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     subtask_status = SubtaskStatus.create(subtask_id)
     bogus_email_id = 1001
     with self.assertRaises(CourseEmail.DoesNotExist):
         # we skip the call that updates subtask status, since we've not set up the InstructorTask
         # for the subtask, and it's not important to the test.
         with patch('bulk_email.tasks.update_subtask_status'):
             send_course_email(entry_id, bogus_email_id, to_list, global_email_context, subtask_status.to_dict())
开发者ID:TabEd,项目名称:edx-platform,代码行数:17,代码来源:test_err_handling.py

示例7: test_send_email_with_locked_instructor_task

# 需要导入模块: from instructor_task.subtasks import SubtaskStatus [as 别名]
# 或者: from instructor_task.subtasks.SubtaskStatus import create [as 别名]
 def test_send_email_with_locked_instructor_task(self):
     # test at a lower level, to ensure that the course gets checked down below too.
     entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
     entry_id = entry.id  # pylint: disable=no-member
     subtask_id = "subtask-id-locked-model"
     initialize_subtask_info(entry, "emailed", 100, [subtask_id])
     subtask_status = SubtaskStatus.create(subtask_id)
     bogus_email_id = 1001
     to_list = ['[email protected]']
     global_email_context = {'course_title': 'dummy course'}
     with patch('instructor_task.subtasks.InstructorTask.save') as mock_task_save:
         mock_task_save.side_effect = DatabaseError
         with self.assertRaises(DatabaseError):
             send_course_email(entry_id, bogus_email_id, to_list, global_email_context, subtask_status.to_dict())
         self.assertEquals(mock_task_save.call_count, MAX_DATABASE_LOCK_RETRIES)
开发者ID:TabEd,项目名称:edx-platform,代码行数:17,代码来源:test_err_handling.py


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