diff --git a/kale/common/podutils.py b/kale/common/podutils.py index e4b9cc16f..adc24c6ee 100644 --- a/kale/common/podutils.py +++ b/kale/common/podutils.py @@ -117,10 +117,10 @@ def get_container_name(): candidates = [c for c in container_names if all(x not in c for x in potentially_sidecar_names)] if len(candidates) > 1: raise RuntimeError( - "Too many container candidates.Cannot infer the" + "Too many container candidates. Cannot infer the" f" name of the current container from: {candidates} " ) - if len(candidates) > 0: + if len(candidates) == 0: raise RuntimeError( "No container names left. Could not infer the name of the running container." ) diff --git a/kale/rpc/kfp.py b/kale/rpc/kfp.py index ec99d4081..aebd4ae96 100644 --- a/kale/rpc/kfp.py +++ b/kale/rpc/kfp.py @@ -84,10 +84,10 @@ def _get_pipeline_id(pipeline_name): client = _get_client() token = "" pipeline_id = None - while pipeline_id is None or token is not None: + while pipeline_id is None and token is not None: pipelines = client.list_pipelines(page_token=token) token = pipelines.next_page_token - f = next(filter(lambda x: x.display_name == pipeline_name, pipelines.pipelines), None) + f = next(filter(lambda x: x.display_name == pipeline_name, pipelines.pipelines or []), None) if f is not None: pipeline_id = f.pipeline_id return pipeline_id