From 25df3b4c756f3c56f88529e4dac33009a3ad7838 Mon Sep 17 00:00:00 2001 From: AbdulHamid Merii <43741215+AH-Merii@users.noreply.github.com> Date: Mon, 19 May 2025 14:22:23 +0100 Subject: [PATCH] Fix unhandled `None` value in project IDs when listing all datasets (#1413) When fetching the project_ids, there are times where the project id may be None, even if that's not supposed to be the case. This causes the program to break. This patch adds some defensive checks to make sure that even if somehow we get None for the project_id, it will be ignored and handled gracefully. --- clearml/datasets/dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clearml/datasets/dataset.py b/clearml/datasets/dataset.py index e6d91068..1fb42882 100644 --- a/clearml/datasets/dataset.py +++ b/clearml/datasets/dataset.py @@ -2094,7 +2094,7 @@ class Dataset(object): exact_match_regex_flag=False, _allow_extra_fields_=True, ) - project_ids = {d.project for d in datasets} + project_ids = {d.project for d in datasets if d.project is not None} # noinspection PyProtectedMember project_id_lookup = Task._get_project_names(list(project_ids)) return [ @@ -2106,7 +2106,7 @@ class Dataset(object): "tags": d.tags, "version": d.runtime.get("version"), } - for d in datasets + for d in datasets if d.project is not None ] def _add_files(