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


Python Task.from_call_report_data方法代码示例

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


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

示例1: test_02_repo_sync_start

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
    def test_02_repo_sync_start(self):
        self.el.update(self.pulp, {'event_types': ['repo.sync.start']})
        self.assertPulpOK()
        self.el.reload(self.pulp)
        report = self.repo.sync(self.pulp)
        # wait till the sync is done
        Task.wait_for_report(self.pulp, report)
        # keep track of all the spawned tasks
        tasks = Task.from_report(self.pulp, report)
        assert tasks, 'no tasks induced'
        # fetch the request as POSTed by pulp event listener to the bin (http://requestb.in/<bin_id>)
        self.bin.reload()
        assert self.bin.request_count == 1, 'invalid event listener POST count (%s)' \
                                                % self.bin.request_count
        el_request = self.bin.requests[0]
        assert el_request.method == 'POST', 'invalid request method: %s' % el_request.method
        # assert the bin was POSTed no later any task finished
        tasks_finished_before_request = [task.id for task in tasks if el_request.time > task.finish_time]
        assert tasks_finished_before_request == [], 'tasks %s finished before request at: %s' % \
                (tasks_finished_before_request, el_request.time)
        # FIXME: not yet specified in docs: assert the bin was not POSTed before any task has started
        # tasks_started_after_request = [task.id for task in tasks if el_request.time < task.start_time]
        # assert tasks_started_after_request == [], 'tasks %s started after request at: %s' % \
        #        (tasks_started_after_request, el_request.time)

        # assert there's a task POSTed to the bin with the same ID pulp reported with sync
        # request.body contains original POSTed task-report-data --- create a Task object from it
        el_task = Task.from_call_report_data(json.loads(el_request.body))
        assert el_task.state == TASK_RUNNING_STATE, 'invalid task state: %s' % el_task.state
        el_task.reload(self.pulp)
        # assert the task is indeed in the tasks list spawned by pulp to perform repo sync
        assert el_task.id in [task.id for task in tasks], 'invalid task id posted: %s' % el_task.id
        assert sorted([u'pulp:repository:EventListenerRepo', u'pulp:action:sync']) == sorted(el_task.data['tags']), \
                'invalid task tags: %s' % el_task.data['tags']
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:36,代码来源:test_23_event_listener.py

示例2: test_03_repo_sync_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_03_repo_sync_finish(self):
     self.el.update(self.pulp, {'event_types': ['repo.sync.finish']})
     self.assertPulpOK()
     self.el.reload(self.pulp)
     report = self.repo.sync(self.pulp)
     # wait till the sync is done
     Task.wait_for_report(self.pulp, report)
     # fetch the tasks sync-call has spawned
     tasks = Task.from_report(self.pulp, report)
     assert tasks, 'no tasks induced'
     # check the requestsb.in got notified
     self.bin.reload()
     assert self.bin.request_count == 1, 'invalid event listener requests count: %s' % \
                                             self.bin.request_count
     el_request = self.bin.requests[0]
     assert el_request.method == 'POST', 'invalid request method: %s' % el_request.method
     # assert the bin was posted no sooner than all tasks have finished
     tasks_finished_after_request = [task.id for task in tasks if el_request.time < task.finish_time]
     assert tasks_finished_after_request, 'tasks %s finished after request at: %s' % \
             (tasks_finished_after_request, el_request.time)
     # the request body contains a task
     el_task = Task.from_call_report_data(json.loads(el_request.body))
     # doesn't work and won't get fixed --- disabling
     # assert el_task.state == TASK_FINISHED_STATE, 'invalid task state: %s' % el_task.state
     el_task.reload(self.pulp)
     # assert proper task was posted
     assert el_task.id in [task.id for task in tasks], 'invalid task id posted: %s' % el_task.id
     assert sorted([u'pulp:repository:EventListenerRepo', u'pulp:action:sync']) == sorted(el_task.data['tags']), \
             'invalid task tags: %s' % el_task.data['tags']
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:31,代码来源:test_23_event_listener.py

示例3: test_05_repo_publish_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_05_repo_publish_finish(self):
     self.el.update(self.pulp, {'event_types': ['repo.publish.finish']})
     self.assertPulpOK()
     self.el.reload(self.pulp)
     report = self.repo.publish(self.pulp, self.distributor.id)
     # wait till publish-induced tasks finish
     Task.wait_for_report(self.pulp, report)
     # fetch the tasks spawned for the publish to perform
     tasks = [task for task in Task.from_report(self.pulp, report) \
             if u'pulp:action:publish' in task.data['tags']]
     assert tasks, 'no tasks induced'
     # assert bin status
     self.bin.reload()
     assert self.bin.request_count == 1, 'invalid event listener requests count: %s' % \
             self.bin.request_count
     el_request = self.bin.requests[0]
     # assert request method
     assert el_request.method == 'POST', 'invalid request method: %s' % el_request.method
     # assert the request was made after all tasks finished
     tasks_finished_after_request = [task.id for task in tasks if el_request.time < task.finish_time]
     # doesn't work --- disabling
     #assert tasks_finished_after_request == [], '%s finished after request at %s' % \
     #        (tasks_finished_after_request, el_request.time)
     # the request body contains a task
     el_task = Task.from_call_report_data(json.loads(el_request.body))
     #assert el_task.state == TASK_FINISHED_STATE, 'invalid task state: %s' % el_task.state
     el_task.reload(self.pulp)
     # assert proper task was posted
     assert el_task.id in [task.id for task in tasks], 'invalid task id posted: %s' % el_task.id
     assert sorted([u'pulp:repository:EventListenerRepo', u'pulp:action:publish']) == sorted(el_task.data['tags']), \
             'invalid task tags: %s' % el_task.data['tags']
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:33,代码来源:test_23_event_listener.py

示例4: _test_02_repo_publish_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def _test_02_repo_publish_finish(self):
     self.el.update(self.pulp, {'event_listener': ['repo.publish.finish']})
     self.el.reload(self.pulp)
     with deleting(self.pulp, *create_yum_repo(self.pulp, 'publish_error_repo',
                 feed='https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/')) as (repo, (importer, distributor)):
         response = repo.publish(self.pulp, 'invalid_distributor_id')
         self.assertPulpOK()
         with self.assertRaises(TaskFailure):
             # make sure the publish task failed
             Task.wait_for_report(self.pulp, response)
         task = Task.from_report(self.pulp, response)
         # assert the bin contains a request with a fained task in body
         self.bin.reload()
         assert self.bin.request_count == 1, 'invalid bin.request_count: %s' % self.bin.request_count
         el_request = self.bin.requests[0]
         assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method
         el_task = Task.from_call_report_data(json.loads(el_request.body))
         assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state
         assert el_task.id in [task.id for task in tasks], 'invalid request.body:Task.id: %s' % el_task.id
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:21,代码来源:test_23_event_listener.py

示例5: test_01_repo_sync_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_01_repo_sync_finish(self):
     self.el.update(self.pulp, {'event_types': ['repo.sync.finish']})
     self.el.reload(self.pulp)
     with deleting(self.pulp, *create_yum_repo(self.pulp, 'sync_error_repo',
                 feed='http://example.com/repos/none')) as (repo, (importer, distributor)):
         response = repo.sync(self.pulp)
         self.assertPulpOK()
         with self.assertRaises(TaskFailure):
             # make sure the sync did not succeed
             Task.wait_for_report(self.pulp, response)
         tasks = Task.from_report(self.pulp, response)
         # assert the bin contains request with a failed task in body
         self.bin.reload()
         assert self.bin.request_count == 1, 'invalid bin.request count: %s' % self.bin.request_count
         el_request = self.bin.requests[0]
         assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method
         el_task = Task.from_call_report_data(json.loads(el_request.body))
         assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state
         assert el_task.id in [task.id for task in tasks], 'invalid request.body:Task.id: %s' % el_task.id
开发者ID:dparalen,项目名称:pulp-automation,代码行数:21,代码来源:test_23_event_listener.py

示例6: _test_02_repo_publish_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def _test_02_repo_publish_finish(self):
     self.el.update(self.pulp, {'event_listener': ['repo.publish.finish']})
     self.el.reload(self.pulp)
     repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
     repo, importer, [distributor] = YumRepo(id='publish_error_repo', importer=Importer.from_role(repo_role),
                             distributors=[YumDistributor(distributor_type_id='invalid_distributor_id', relative_url='xyz')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor):
         response = repo.publish(self.pulp, 'invalid_distributor_id')
         self.assertPulpOK()
         with self.assertRaises(TaskFailure):
             # make sure the publish task failed
             Task.wait_for_report(self.pulp, response)
         task = Task.from_report(self.pulp, response)
         # assert the bin contains a request with a fained task in body
         self.bin.reload()
         assert self.bin.request_count == 1, 'invalid bin.request_count: %s' % self.bin.request_count
         el_request = self.bin.requests[0]
         assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method
         el_task = Task.from_call_report_data(json.loads(el_request.body))
         assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state
         assert el_task.id in [task.id for task in tasks], 'invalid request.body:Task.id: %s' % el_task.id
开发者ID:RedHatQE,项目名称:pulp-automation,代码行数:23,代码来源:test_23_event_listener.py

示例7: test_06_wildcard_events

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_06_wildcard_events(self):
     # prepare event listener
     self.el.update(self.pulp, {'event_types': ['*']})
     self.assertPulpOK()
     self.el.reload(self.pulp)
     # trigger repo sync and publish; wait for related tasks to finish
     sync_report = self.repo.sync(self.pulp)
     Task.wait_for_report(self.pulp, sync_report)
     publish_report = self.repo.publish(self.pulp, self.distributor.id)
     Task.wait_for_report(self.pulp, publish_report)
     # fetch tasks data
     sync_tasks = Task.from_report(self.pulp, sync_report)
     publish_tasks = Task.from_report(self.pulp, publish_report)
     assert sync_tasks, 'no sync tasks induced'
     assert publish_tasks, 'no publish tasks induced'
     # assert bin status
     self.bin.reload()
     assert self.bin.request_count == 4, 'invalid event listener request count: %s' % \
             self.bin.request_count
     el_request_tasks = [Task.from_call_report_data(json.loads(request.body)) for request in self.bin.requests]
     # the POSTed tasks should look like this
     # - sync running task for repo.sync.start event
     # - sync finished task for repo.sync.finis  event --- doesn't work, won't get fixed --- disabling
     # - publish running task for repo.publish.start event
     # - publish finished task for repo.publish.finish event --- doesn't work, won't get fixed --- disabling
     el_sync_start_task, el_sync_finish_task, el_publish_start_task, el_publish_finish_task = el_request_tasks
     # sync part
     assert el_sync_start_task.state == TASK_RUNNING_STATE, 'invalid state: %s' % el_sync_start_task.state
     assert el_sync_start_task.id in [task.id for task in sync_tasks], 'invalid task posted: %s' % el_sync_start_task.id
     #assert el_sync_finish_task.state == TASK_FINISHED_STATE, 'invalid state: %s' % el_sync_finish_task.state
     assert el_sync_finish_task.id in [task.id for task in sync_tasks], 'invalid task posted: %s' % el_sync_finish_task.id
     # start and finish are the same task but posted twice (with different state)
     assert el_sync_start_task.id == el_sync_finish_task.id, 'sync start and finish events refer to different tasks respectively'
     # publish part
     assert el_publish_start_task.state == TASK_RUNNING_STATE, 'invalid state: %s' % el_publish_start_task.state
     assert el_publish_start_task.id in [task.id for task in publish_tasks], 'invalid task posted: %s' % el_publish_start_task.id
     #assert el_publish_finish_task.state == TASK_FINISHED_STATE, 'invalid state: %s' % el_publish_finish_task.state
     assert el_publish_finish_task.id in [task.id for task in publish_tasks], 'invalid task posted: %' % el_publish_finish_task.id
     # start and finish are the same task but posted twice (with different state)
     assert el_publish_start_task.id == el_publish_finish_task.id, 'publish start and finish events refer to different tasks respectively'
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:42,代码来源:test_23_event_listener.py

示例8: test_01_repo_sync_finish

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_01_repo_sync_finish(self):
     self.el.update(self.pulp, {'event_types': ['repo.sync.finish']})
     self.el.reload(self.pulp)
     repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0]
     repo, importer, [distributor] = YumRepo(id='sync_error_repo',
                     importer=YumImporter(feed='http://example.com/repos/none'),
                     distributors=[YumDistributor(relative_url='/repos/none')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor):
         response = repo.sync(self.pulp)
         self.assertPulpOK()
         with self.assertRaises(TaskFailure):
             # make sure the sync did not succeed
             Task.wait_for_report(self.pulp, response)
         tasks = Task.from_report(self.pulp, response)
         # assert the bin contains request with a failed task in body
         self.bin.reload()
         assert self.bin.request_count == 1, 'invalid bin.request count: %s' % self.bin.request_count
         el_request = self.bin.requests[0]
         assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method
         el_task = Task.from_call_report_data(json.loads(el_request.body))
         # doesn't work and won't get fixed --- disabling
         # assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state
         assert el_task.id in [task.id for task in tasks], 'invalid request.body:Task.id: %s' % el_task.id
开发者ID:RedHatQE,项目名称:pulp-automation,代码行数:25,代码来源:test_23_event_listener.py

示例9: test_04_repo_publish_start

# 需要导入模块: from pulp_auto.task import Task [as 别名]
# 或者: from pulp_auto.task.Task import from_call_report_data [as 别名]
 def test_04_repo_publish_start(self):
     self.el.update(self.pulp, {'event_types': ['repo.publish.start']})
     self.assertPulpOK()
     self.el.reload(self.pulp)
     report = self.repo.publish(self.pulp, self.distributor.id)
     # wait till report-induced tasks finish
     Task.wait_for_report(self.pulp, report)
     # fetch the tasks spawned for report; only
     sync_tasks = [task for task in Task.from_report(self.pulp, report) \
             if u'pulp:action:sync' in task.data['tags']]
     publish_tasks = [task for task in Task.from_report(self.pulp, report) \
             if u'pulp:action:publish' in task.data['tags']]
     assert publish_tasks, 'no publish tasks induced'
     self.bin.reload()
     assert self.bin.request_count == 1, 'invalid event listener requests count: %s' % \
             self.bin.request_count
     el_request = self.bin.requests[0]
     assert el_request.method == 'POST', 'invalid request method: %s' % el_request.method
     # assert the event was not triggered after any publish task finished
     publish_tasks_finished_before_request = [task.id for task in publish_tasks \
             if el_request.time > task.finish_time]
     assert publish_tasks_finished_before_request == [], '%s publish tasks finished before request at: %s' % \
             (publish_tasks_finished_before_request, el_request.time)
     # assert the event was not triggered before all sync tasks finished
     sync_tasks_finished_after_request = [task.id for task in sync_tasks \
             if el_request.time < sync_task.finish_time]
     assert sync_tasks_finished_after_request == [], '%s sync tasks finished after request at: %s' % \
             (sync_tasks_finished_after_request, el_request.time)
     # the request body contains a task
     el_task = Task.from_call_report_data(json.loads(el_request.body))
     assert el_task.state == TASK_RUNNING_STATE, 'invalid task state: %s' % el_task.state
     el_task.reload(self.pulp)
     # assert proper task was posted
     assert el_task.id in [task.id for task in publish_tasks], 'invalid task id posted: %s' % el_task.id
     assert sorted([u'pulp:repository:EventListenerRepo', u'pulp:action:publish']) == sorted(el_task.data['tags']), \
             'invalid task tags: %s' % el_task.data['tags']
开发者ID:CUXIDUMDUM,项目名称:pulp-automation,代码行数:38,代码来源:test_23_event_listener.py


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