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


Python beat.ScheduleEntry方法代码示例

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


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

示例1: test_serialize_entry_json_serializable

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def test_serialize_entry_json_serializable(dt):
    entry = ScheduleEntry(
        name='entry-1',
        task='entry-1-task',
        schedule=dt,
        args=('arg1', 'arg2'),
        kwargs={'key1': 'val1', 'key2': 'val2'},
        last_run_at=datetime.now(),
        total_run_count=1,
        options={},
    )

    obj = serialize_entry(entry)

    try:
        json.dumps(obj)
    except Exception as e:
        pytest.fail(e) 
开发者ID:mixkorshun,项目名称:celery-beatx,代码行数:20,代码来源:test_serializer.py

示例2: serialize_entry

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def serialize_entry(entry):
    """
    Serialize ScheduleEntry to json-valid dictionary.

    Helps serialize entry to json, yml and any other formats.

    :param entry: ScheduleEntry
    :return: json-valid dictionary
    """
    return {
        'name': entry.name,
        'task': entry.task,
        'schedule': encode_schedule(entry.schedule),
        'args': entry.args,
        'kwargs': entry.kwargs,
        'last_run_at': encode_datetime(entry.last_run_at),
        'total_run_count': entry.total_run_count,
        'options': entry.options
    } 
开发者ID:mixkorshun,项目名称:celery-beatx,代码行数:21,代码来源:serializer.py

示例3: deserialize_entry

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def deserialize_entry(entry):
    """
    Deserialize ScheduleEntry from dictionary.

    Helps deserialize entry from json, yml and any other formats.

    :param entry:
    :return:
    """
    return ScheduleEntry(
        name=entry['name'],
        task=entry['task'],
        schedule=decode_schedule(entry['schedule']),
        args=entry['args'],
        kwargs=entry['kwargs'],
        last_run_at=decode_datetime(entry['last_run_at']),
        total_run_count=entry['total_run_count'],
        options=entry['options'],
    ) 
开发者ID:mixkorshun,项目名称:celery-beatx,代码行数:21,代码来源:serializer.py

示例4: setup_schedule

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def setup_schedule(self):
        logging.debug("Setting up scheduler")
        for entry_name, entry in self.loaded_entries.items():
            if isinstance(entry, ScheduleEntry):
                self._schedule[entry_name] = BaseScheduleEntry(
                    name=entry_name,
                    app=self.app,
                    task=entry.SCHEDULED_TASK,
                    schedule=entry.frequency,
                    args=(str(entry.id),)) 
开发者ID:yeti-platform,项目名称:yeti,代码行数:12,代码来源:scheduling.py

示例5: test_entries_save_load

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def test_entries_save_load(self):
        entries = {
            'entry-1': ScheduleEntry(
                name='entry-1',
                last_run_at=datetime.utcnow()
            ),
        }

        self.store.save_entries(entries)

        loaded = self.store.load_entries()

        assert entries.keys() == loaded.keys() 
开发者ID:mixkorshun,项目名称:celery-beatx,代码行数:15,代码来源:test_store.py

示例6: test_serialize_deserialize_entry

# 需要导入模块: from celery import beat [as 别名]
# 或者: from celery.beat import ScheduleEntry [as 别名]
def test_serialize_deserialize_entry(dt):
    entry = ScheduleEntry(
        name='entry-1',
        task='entry-1-task',
        schedule=dt,
        args=('arg1', 'arg2'),
        kwargs={'key1': 'val1', 'key2': 'val2'},
        last_run_at=datetime.now(),
        total_run_count=1,
        options={},
    )

    decoded_entry = deserialize_entry(serialize_entry(entry))

    assert decoded_entry.__reduce__() == entry.__reduce__() 
开发者ID:mixkorshun,项目名称:celery-beatx,代码行数:17,代码来源:test_serializer.py


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