示例#1
0
文件: manager.py 项目: anodot/daria
def stop(pipeline_: Pipeline):
    try:
        sdc_client.stop(pipeline_)
        reset_pipeline_retries(pipeline_)
    except (sdc_client.ApiClientException,
            sdc_client.StreamsetsException) as e:
        raise pipeline.PipelineException(str(e)) from e
示例#2
0
文件: manager.py 项目: anodot/daria
def delete(pipeline_: Pipeline):
    _delete_schema(pipeline_)
    try:
        sdc_client.delete(pipeline_)
    except sdc_client.ApiClientException as e:
        raise pipeline.PipelineException(str(e)) from e
    pipeline.repository.delete(pipeline_)
    pipeline.repository.add_deleted_pipeline_id(pipeline_.name)
示例#3
0
文件: manager.py 项目: anodot/daria
def reset(pipeline_: Pipeline):
    try:
        sdc_client.reset(pipeline_)
        if pipeline_.offset:
            pipeline.repository.delete_offset(pipeline_.offset)
            pipeline_.offset = None
    except sdc_client.ApiClientException as e:
        raise pipeline.PipelineException(str(e)) from e
示例#4
0
def _build_multiple(configs: list, build_func: Callable) -> List[Pipeline]:
    _validate_configs_for_create(configs)
    exceptions = {}
    pipelines = []
    for config in configs:
        try:
            pipeline.manager.check_pipeline_id(config['pipeline_id'])
            pipelines.append(build_func(config))
        except Exception as e:
            exceptions[config['pipeline_id']] = f'{type(e).__name__}: {e}'
            logger_.debug(e, exc_info=True)
    if exceptions:
        raise pipeline.PipelineException(json.dumps(exceptions))
    return pipelines
示例#5
0
def edit_multiple(configs: list) -> List[Pipeline]:
    if not isinstance(configs, list):
        raise ValueError(
            f'Provided data must be a list of configs, {type(configs).__name__} provided instead'
        )
    exceptions = {}
    pipelines = []
    for config in configs:
        try:
            pipelines.append(edit(config))
        except Exception as e:
            exceptions[config['pipeline_id']] = f'{type(e).__name__}: {e}'
            logger_.debug(e, exc_info=True)
        if exceptions:
            raise pipeline.PipelineException(json.dumps(exceptions))
    return pipelines
示例#6
0
文件: manager.py 项目: anodot/daria
def check_pipeline_id(pipeline_id: str):
    if pipeline.repository.exists(pipeline_id):
        raise pipeline.PipelineException(
            f"Pipeline {pipeline_id} already exists")
示例#7
0
文件: manager.py 项目: anodot/daria
def get_metrics(pipeline_: Pipeline) -> PipelineMetric:
    try:
        return PipelineMetric(sdc_client.get_pipeline_metrics(pipeline_))
    except (sdc_client.ApiClientException,
            sdc_client.StreamsetsException) as e:
        raise pipeline.PipelineException(str(e)) from e
示例#8
0
文件: manager.py 项目: anodot/daria
def get_info(pipeline_: Pipeline, lines: int) -> dict:
    try:
        return sdc_client.get_pipeline_info(pipeline_, lines)
    except (sdc_client.ApiClientException,
            sdc_client.StreamsetsException) as e:
        raise pipeline.PipelineException(str(e)) from e