From 21293c3fcb847dacd4b9e3348545eedc1c2599a0 Mon Sep 17 00:00:00 2001 From: Anton Karakochev Date: Thu, 7 May 2020 17:34:29 +0200 Subject: [PATCH] make sure experiments list is not empty before accessing --- dvc-cc/dvc_cc/run/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dvc-cc/dvc_cc/run/main.py b/dvc-cc/dvc_cc/run/main.py index 4deae3b..9c452ed 100644 --- a/dvc-cc/dvc_cc/run/main.py +++ b/dvc-cc/dvc_cc/run/main.py @@ -209,7 +209,8 @@ def get_last_cc_experimentid(keyring_service): ) r.raise_for_status() a = r.json() - return sorted(a,key=lambda x: x['registrationTime'])[-1]['_id'] + # make sure a is not empty before directly acessing + return sorted(a,key=lambda x: x['registrationTime'])[-1]['_id'] if a else None def create_cc_config(dvc_files, exp_name, rcc_branch_names, num_of_repeats, live_output_files,