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


Python Job.isRunning方法代码示例

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


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

示例1: test_isRunning_happy_path

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import isRunning [as 别名]
    def test_isRunning_happy_path(self, mock_execute_command, mock_update):
        job = Job(change_num="change_num", project_name="project")
        job.node_ip = 'ip'
        delta = datetime.timedelta(seconds=350)
        job.updated = datetime.datetime.now() - delta

        mock_execute_command.return_value = False
        self.assertFalse(job.isRunning("DB"))
        self.assertEqual(0, mock_update.call_count)

        mock_execute_command.return_value = True
        self.assertTrue(job.isRunning("DB"))
        self.assertEqual(0, mock_update.call_count)
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:15,代码来源:test_job.py

示例2: test_isRunning_timeout

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import isRunning [as 别名]
 def test_isRunning_timeout(self, mock_update):
     job = Job(change_num="change_num", project_name="project")
     job.node_ip = 'ip'
     delta = datetime.timedelta(seconds=int(Configuration().MAX_RUNNING_TIME))
     job.updated = datetime.datetime.now() - delta
     self.assertFalse(job.isRunning("DB"))
     mock_update.assert_called_with("DB", result='Aborted: Timed out')
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:9,代码来源:test_job.py

示例3: test_isRunning_pid_fail

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import isRunning [as 别名]
    def test_isRunning_pid_fail(self, mock_execute_command, mock_update):
        job = Job(change_num="change_num", project_name="project")
        job.node_ip = 'ip'
        delta = datetime.timedelta(seconds=350)
        job.updated = datetime.datetime.now() - delta
        mock_execute_command.side_effect=Exception('SSH error getting PID')
        self.assertFalse(job.isRunning("DB"))

        mock_update.assert_called_with("DB", result='Aborted: Exception checking for pid')
        self.assertEqual(1, mock_execute_command.call_count)
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:12,代码来源:test_job.py

示例4: test_isRunning_early_wait

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import isRunning [as 别名]
 def test_isRunning_early_wait(self):
     job = Job(change_num="change_num", project_name="project")
     job.node_ip = 'ip'
     job.updated = datetime.datetime.now()
     self.assertTrue(job.isRunning("DB"))
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:7,代码来源:test_job.py

示例5: test_isRunning_no_ip

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import isRunning [as 别名]
    def test_isRunning_no_ip(self):
        job = Job(change_num="change_num", project_name="project")

        self.assertFalse(job.isRunning("DB"))
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:6,代码来源:test_job.py


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