コード例 #1
0
ファイル: manager.py プロジェクト: anodot/daria
def transform_for_bc(pipeline_: Pipeline) -> dict:
    data = {
        'pipeline_id':
        pipeline_.name,
        'created':
        int(pipeline_.created_at.timestamp()),
        'updated':
        int(pipeline_.last_edited.timestamp()),
        'status':
        pipeline_.status,
        'schemaId':
        pipeline_.get_schema_id(),
        'source': {
            'name': pipeline_.source.name,
            'type': pipeline_.source.type,
        },
        'scheduling': {
            'interval': pipeline_.interval,
            'delay': pipeline_.delay,
        },
        'progress': {
            'last_offset': pipeline_.offset.offset if pipeline_.offset else '',
        },
        # we need to always send schema even if the pipeline doesn't use it
        'schema':
        pipeline_.get_schema()
        if pipeline_.get_schema_id() else schema.build(pipeline_),
        'config':
        pipeline_.config,
    }
    data['config'].pop('interval', 0)
    data['config'].pop('delay', 0)
    return data
コード例 #2
0
ファイル: manager.py プロジェクト: anodot/daria
def _update_schema(pipeline_: Pipeline):
    new_schema = schema.build(pipeline_)
    if old_schema := pipeline_.get_schema():
        if not schema.equal(old_schema, new_schema):
            pipeline_.schema = schema.update(new_schema)
        return