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


Python ScheduledCall._calculate_times方法代码示例

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


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

示例1: test_last_scheduled_run_no_first_run

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_last_scheduled_run_no_first_run(self):
        call = ScheduledCall('PT1H', 'pulp.tasks.dosomething')

        last_scheduled_run_s = call._calculate_times()[4]
        first_run_s = call._calculate_times()[1]

        self.assertEqual(last_scheduled_run_s, first_run_s)
开发者ID:aweiteka,项目名称:pulp,代码行数:9,代码来源:test_dispatch.py

示例2: test_run_every

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_run_every(self):
        call = ScheduledCall('2014-01-03T10:15Z/PT1H', 'pulp.tasks.dosomething')

        run_every_s = call._calculate_times()[3]

        # 1 hour, as specified in the ISO8601 string above
        self.assertEqual(run_every_s, 3600)
开发者ID:aweiteka,项目名称:pulp,代码行数:9,代码来源:test_dispatch.py

示例3: test_since_first

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_since_first(self):
        call = ScheduledCall('2014-01-03T10:15Z/PT1H', 'pulp.tasks.dosomething')

        since_first = call._calculate_times()[2]
        now = time.time()

        self.assertTrue(since_first + 1388744100 - now < 1)
开发者ID:aweiteka,项目名称:pulp,代码行数:9,代码来源:test_dispatch.py

示例4: test_first_run_now

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_first_run_now(self):
        call = ScheduledCall('PT1M', 'pulp.tasks.dosomething')

        first_run_s = call._calculate_times()[1]

        # make sure this gives us a timestamp that reasonably represents "now"
        self.assertTrue(time.time() - first_run_s < 1)
开发者ID:aweiteka,项目名称:pulp,代码行数:9,代码来源:test_dispatch.py

示例5: test_last_scheduled_run_with_first_run

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_last_scheduled_run_with_first_run(self, mock_time):
        # specify a start time and current time such that we know the difference
        mock_time.return_value = 1389307330.966561
        call = ScheduledCall('2014-01-09T17:15Z/PT1H', 'pulp.tasks.dosomething')

        last_scheduled_run_s = call._calculate_times()[4]

        self.assertEqual(last_scheduled_run_s, 1389305700)
开发者ID:aweiteka,项目名称:pulp,代码行数:10,代码来源:test_dispatch.py

示例6: test_first_run_scheduled

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_first_run_scheduled(self):
        call = ScheduledCall('2014-01-03T10:15Z/PT1H', 'pulp.tasks.dosomething')

        first_run_s = call._calculate_times()[1]

        # make sure this gives us a timestamp for the date and time
        # specified above
        self.assertEqual(first_run_s, 1388744100)
开发者ID:aweiteka,项目名称:pulp,代码行数:10,代码来源:test_dispatch.py

示例7: test_expected_runs_positive

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_expected_runs_positive(self, mock_time):
        # specify a start time and current time such that we know the difference
        mock_time.return_value = 1389307330.966561
        call = ScheduledCall('2014-01-09T17:15Z/PT1H', 'pulp.tasks.dosomething')

        expected_runs = call._calculate_times()[5]

        # we know that it's been more than 5 hours since the first scheduled run
        self.assertEqual(expected_runs, 5)
开发者ID:aweiteka,项目名称:pulp,代码行数:11,代码来源:test_dispatch.py

示例8: test_expected_runs_future

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_expected_runs_future(self, mock_time):
        # specify a start time and current time such that the start appears to
        # be in the future
        mock_time.return_value = 1389307330.966561
        call = ScheduledCall('2014-01-19T17:15Z/PT1H', 'pulp.tasks.dosomething')

        expected_runs = call._calculate_times()[5]

        # the first run is scheduled in the future (relative to the mock time),
        # so there should not be any runs.
        self.assertEqual(expected_runs, 0)
开发者ID:aweiteka,项目名称:pulp,代码行数:13,代码来源:test_dispatch.py

示例9: test_first_run_saved

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_first_run_saved(self):
        """
        Test that when the first run is passed in from historical data.
        """
        call = ScheduledCall('PT1H', 'pulp.tasks.dosomething', first_run='2014-01-03T10:15Z')

        first_run_s = call._calculate_times()[1]

        # make sure this gives us a timestamp for the date and time
        # specified above
        self.assertEqual(first_run_s, 1388744100)
开发者ID:aweiteka,项目名称:pulp,代码行数:13,代码来源:test_dispatch.py

示例10: test_expected_runs_zero

# 需要导入模块: from pulp.server.db.model.dispatch import ScheduledCall [as 别名]
# 或者: from pulp.server.db.model.dispatch.ScheduledCall import _calculate_times [as 别名]
    def test_expected_runs_zero(self):
        call = ScheduledCall('PT1H', 'pulp.tasks.dosomething')

        expected_runs = call._calculate_times()[5]

        self.assertEqual(expected_runs, 0)
开发者ID:aweiteka,项目名称:pulp,代码行数:8,代码来源:test_dispatch.py


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